Documentation
¶
Overview ¶
Package beaglebone provides the Gobot adaptor for the Beaglebone Black.
Installing:
go get gobot.io/x/platforms/gobot/beaglebone
Example:
package main
import (
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/drivers/gpio"
"gobot.io/x/gobot/platforms/beaglebone"
)
func main() {
beagleboneAdaptor := beaglebone.NewAdaptor()
led := gpio.NewLedDriver(beagleboneAdaptor, "P9_12")
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
robot := gobot.NewRobot("blinkBot",
[]gobot.Connection{beagleboneAdaptor},
[]gobot.Device{led},
work,
)
robot.Start()
}
For more information refer to the beaglebone README: https://gobot.io/x/gobot/blob/master/platforms/beaglebone/README.md
Index ¶
- type Adaptor
- func (b *Adaptor) AnalogRead(pin string) (val int, err error)
- func (b *Adaptor) Connect() error
- func (b *Adaptor) DigitalRead(pin string) (val int, err error)
- func (b *Adaptor) DigitalWrite(pin string, val byte) (err error)
- func (b *Adaptor) Finalize() (err error)
- func (b *Adaptor) I2cRead(address int, size int) (data []byte, err error)
- func (b *Adaptor) I2cStart(address int) (err error)
- func (b *Adaptor) I2cWrite(address int, data []byte) (err error)
- func (b *Adaptor) Kernel() string
- func (b *Adaptor) Name() string
- func (b *Adaptor) PwmWrite(pin string, val byte) (err error)
- func (b *Adaptor) ServoWrite(pin string, val byte) (err error)
- func (b *Adaptor) SetName(n string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶ added in v1.0.0
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is the gobot.Adaptor representation for the Beaglebone
func NewAdaptor ¶ added in v1.0.0
func NewAdaptor() *Adaptor
NewAdaptor returns a new Beaglebone Adaptor
func (*Adaptor) AnalogRead ¶ added in v1.0.0
AnalogRead returns an analog value from specified pin
func (*Adaptor) DigitalRead ¶ added in v1.0.0
DigitalRead returns a digital value from specified pin
func (*Adaptor) DigitalWrite ¶ added in v1.0.0
DigitalWrite writes a digital value to specified pin. valid usr pin values are usr0, usr1, usr2 and usr3
func (*Adaptor) Finalize ¶ added in v1.0.0
Finalize releases all i2c devices and exported analog, digital, pwm pins.
func (*Adaptor) I2cStart ¶ added in v1.0.0
I2cStart starts a i2c device in specified address on i2c bus /dev/i2c-1
func (*Adaptor) ServoWrite ¶ added in v1.0.0
ServoWrite writes the 0-180 degree val to the specified pin.