hybridgroup.gobot/platforms/beaglebone
Adrian Zankich 1d24bd8866 Update READMEs 2014-07-10 17:02:00 -07:00
..
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md Update READMEs 2014-07-10 17:02:00 -07:00
analog_pin.go Write to pwm pin when its ready 2014-06-30 19:50:28 -07:00
beaglebone_adaptor.go Update examples 2014-07-08 18:36:14 -07:00
beaglebone_adaptor_test.go Write to pwm pin when its ready 2014-06-30 19:50:28 -07:00
digital_pin.go Write to pwm pin when its ready 2014-06-30 19:50:28 -07:00
i2c_device.go Make golint happy 2014-06-10 15:16:11 -07:00
pwm_pin.go Write to pwm pin when its ready 2014-06-30 19:50:28 -07:00

README.md

Beaglebone

This package provides the Gobot adaptor for the Beaglebone Black

Getting Started

Installing

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/platforms/gobot/beaglebone

Cross compiling for the Beaglebone Black

You must first configure your Go environment for arm linux cross compiling

$ cd $GOROOT/src
$ GOOS=linux GOARCH=arm ./make.bash --no-clean

Then compile your Gobot program with

$ GOARM=7 GOARCH=arm GOOS=linux go build examples/beaglebone_blink.go

If you are running the official Angstrom or Debian linux through the usb->ethernet connection, you can simply upload your program and execute it with

$ scp beaglebone_blink root@192.168.7.2:/home/root/
$ ssh -t root@192.168.7.2 "./beaglebone_blink"

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()
}