Documentation ¶
Overview ¶
Package beaglebone provides the Gobot adaptor for the Beaglebone Black.
Installing:
go get github.com/hybridgroup/platforms/gobot/beaglebone
Example:
package main import ( "time" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/beaglebone" "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { gbot := gobot.NewGobot() beagleboneAdaptor := beaglebone.NewBeagleboneAdaptor("beaglebone") led := gpio.NewLedDriver(beagleboneAdaptor, "led", "P9_12") work := func() { gobot.Every(1*time.Second, func() { led.Toggle() }) } robot := gobot.NewRobot("blinkBot", []gobot.Connection{beagleboneAdaptor}, []gobot.Device{led}, work, ) gbot.AddRobot(robot) gbot.Start() }
For more information refer to the beaglebone README: https://github.com/hybridgroup/gobot/blob/master/platforms/beaglebone/README.md
Index ¶
- type BeagleboneAdaptor
- func (b *BeagleboneAdaptor) AnalogRead(pin string) int
- func (b *BeagleboneAdaptor) AnalogWrite(pin string, val byte)
- func (b *BeagleboneAdaptor) Connect() bool
- func (b *BeagleboneAdaptor) DigitalRead(pin string) (i int)
- func (b *BeagleboneAdaptor) DigitalWrite(pin string, val byte)
- func (b *BeagleboneAdaptor) Finalize() bool
- func (b *BeagleboneAdaptor) I2cRead(size uint) []byte
- func (b *BeagleboneAdaptor) I2cStart(address byte)
- func (b *BeagleboneAdaptor) I2cWrite(data []byte)
- func (b *BeagleboneAdaptor) InitServo()
- func (b *BeagleboneAdaptor) PwmWrite(pin string, val byte)
- func (b *BeagleboneAdaptor) ServoWrite(pin string, val byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeagleboneAdaptor ¶
func NewBeagleboneAdaptor ¶
func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor
NewBeagleboneAdaptor returns a new beaglebone adaptor with specified name
func (*BeagleboneAdaptor) AnalogRead ¶
func (b *BeagleboneAdaptor) AnalogRead(pin string) int
AnalogRead returns an analog value from specified pin
func (*BeagleboneAdaptor) AnalogWrite ¶
func (b *BeagleboneAdaptor) AnalogWrite(pin string, val byte)
AnalogWrite writes an analog value to specified pin
func (*BeagleboneAdaptor) Connect ¶
func (b *BeagleboneAdaptor) Connect() bool
Connect returns true on a succesful connection to beaglebone board. It initializes digital, pwm and analog pins
func (*BeagleboneAdaptor) DigitalRead ¶
func (b *BeagleboneAdaptor) DigitalRead(pin string) (i int)
DigitalRead returns a digital value from specified pin
func (*BeagleboneAdaptor) DigitalWrite ¶
func (b *BeagleboneAdaptor) DigitalWrite(pin string, val byte)
DigitalWrite writes a digital value to specified pin. valid usr pin values are usr0, usr1, usr2 and usr3
func (*BeagleboneAdaptor) Finalize ¶
func (b *BeagleboneAdaptor) Finalize() bool
Finalize returns true when board connection is finalized correctly.
func (*BeagleboneAdaptor) I2cRead ¶
func (b *BeagleboneAdaptor) I2cRead(size uint) []byte
I2cRead returns value from i2c device using specified size
func (*BeagleboneAdaptor) I2cStart ¶
func (b *BeagleboneAdaptor) I2cStart(address byte)
I2cStart starts a i2c device in specified address
func (*BeagleboneAdaptor) I2cWrite ¶
func (b *BeagleboneAdaptor) I2cWrite(data []byte)
I2CWrite writes data to i2c device
func (*BeagleboneAdaptor) InitServo ¶
func (b *BeagleboneAdaptor) InitServo()
InitServo starts servo (not yet implemented)
func (*BeagleboneAdaptor) PwmWrite ¶
func (b *BeagleboneAdaptor) PwmWrite(pin string, val byte)
PwmWrite writes value in specified pin
func (*BeagleboneAdaptor) ServoWrite ¶
func (b *BeagleboneAdaptor) ServoWrite(pin string, val byte)
ServoWrite writes scaled value to servo in specified pin