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) (val int, err error)
- func (b *BeagleboneAdaptor) Connect() (errs []error)
- func (b *BeagleboneAdaptor) DigitalRead(pin string) (val int, err error)
- func (b *BeagleboneAdaptor) DigitalWrite(pin string, val byte) (err error)
- func (b *BeagleboneAdaptor) Finalize() (errs []error)
- func (b *BeagleboneAdaptor) I2cRead(size uint) (data []byte, err error)
- func (b *BeagleboneAdaptor) I2cStart(address byte) (err error)
- func (b *BeagleboneAdaptor) I2cWrite(data []byte) (err error)
- func (b *BeagleboneAdaptor) Name() string
- func (b *BeagleboneAdaptor) PwmWrite(pin string, val byte) (err error)
- func (b *BeagleboneAdaptor) ServoWrite(pin string, val byte) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BeagleboneAdaptor ¶
type BeagleboneAdaptor struct {
// contains filtered or unexported fields
}
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) (val int, err error)
AnalogRead returns an analog value from specified pin
func (*BeagleboneAdaptor) Connect ¶
func (b *BeagleboneAdaptor) Connect() (errs []error)
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) (val int, err error)
DigitalRead returns a digital value from specified pin
func (*BeagleboneAdaptor) DigitalWrite ¶
func (b *BeagleboneAdaptor) DigitalWrite(pin string, val byte) (err error)
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() (errs []error)
Finalize returns true when board connection is finalized correctly.
func (*BeagleboneAdaptor) I2cRead ¶
func (b *BeagleboneAdaptor) I2cRead(size uint) (data []byte, err error)
I2cRead returns value from i2c device using specified size
func (*BeagleboneAdaptor) I2cStart ¶
func (b *BeagleboneAdaptor) I2cStart(address byte) (err error)
I2cStart starts a i2c device in specified address
func (*BeagleboneAdaptor) I2cWrite ¶
func (b *BeagleboneAdaptor) I2cWrite(data []byte) (err error)
I2CWrite writes data to i2c device
func (*BeagleboneAdaptor) Name ¶
func (b *BeagleboneAdaptor) Name() string
func (*BeagleboneAdaptor) PwmWrite ¶
func (b *BeagleboneAdaptor) PwmWrite(pin string, val byte) (err error)
PwmWrite writes value in specified pin
func (*BeagleboneAdaptor) ServoWrite ¶
func (b *BeagleboneAdaptor) ServoWrite(pin string, val byte) (err error)
ServoWrite writes scaled value to servo in specified pin