README ¶
Beaglebone
The BeagleBone is an ARM based single board computer, with lots of GPIO, I2C, and analog interfaces built in.
The Gobot adaptor for the BeagleBone should support all of the various BeagleBone boards such as the BeagleBone Black, SeeedStudio BeagleBone Green, SeeedStudio BeagleBone Green Wireless, and others that use the latest Debian and standard "Cape Manager" interfaces.
We recommend updating to the latest Debian Jessie OS when using the BeagleBone, however Gobot should also support older versions of the OS, should your application require this.
For more info about the BeagleBone platform go to http://beagleboard.org/getting-started.
How to Install
go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/beaglebone
How to Use
The pin numbering used by your Gobot program should match the way your board is labeled right on the board itself.
Gobot also has support for the four built-in LEDs on the BeagleBone Black, by referring to them as usr0
, usr1
, usr2
, and usr3
.
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()
}
How to Connect
Compiling
Simply compile your Gobot program like this:
$ GOARM=7 GOARCH=arm GOOS=linux go build examples/beaglebone_blink.go
If you are running the official Debian Linux through the usb->ethernet connection, or are connected to the board using WiFi, you can simply upload your program and execute it with the scp
command like this:
$ scp beaglebone_blink root@192.168.7.2:/home/root/
$ ssh -t root@192.168.7.2 "./beaglebone_blink"
Updating your board to the latest OS
We recommend updating your BeagleBone to the latest Debian OS. It is very easy to do this using the Etcher (https://etcher.io/) utility program.
First, download the latest BeagleBone OS from http://beagleboard.org/latest-images
Now, use Etcher to create an SD card with the OS image you have downloaded.
Once you have created the SD card, boot your BeagleBone using the new image as follows:
-
Insert SD card into your (powered-down) board, hold down the USER/BOOT button (if using Black) and apply power, either by the USB cable or 5V adapter.
-
If all you want to do it boot once from the SD card, it should now be booting.
-
If using BeagleBone Black and desire to write the image to your on-board eMMC, you'll need to follow the instructions at http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC. When the flashing is complete, all 4 USRx LEDs will be steady on or off. The latest Debian flasher images automatically power down the board upon completion. This can take up to 45 minutes. Power-down your board, remove the SD card and apply power again to be complete.
These instructions come from the Beagleboard web site's "Getting Started" page located here:
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.