beaglebone

package
v0.0.0-...-5ffa399 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2015 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

README

Beaglebone

The BeagleBone is an ARM based single board computer, with many different GPIO interfaces built in.

For more info about the BeagleBone platform click here.

How to Install

go get -d -u github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/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"

How to Use

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

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

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
}

BeagleboneAdaptor is the gobot.Adaptor representation for the Beaglebone

func NewBeagleboneAdaptor

func NewBeagleboneAdaptor(name string) *BeagleboneAdaptor

NewBeagleboneAdaptor returns a new BeagleboneAdaptor 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 initializes the pwm and analog dts.

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 releases all i2c devices and exported analog, digital, pwm pins.

func (*BeagleboneAdaptor) I2cRead

func (b *BeagleboneAdaptor) I2cRead(size uint) (data []byte, err error)

I2cRead returns size bytes from the i2c device

func (*BeagleboneAdaptor) I2cStart

func (b *BeagleboneAdaptor) I2cStart(address byte) (err error)

I2cStart starts a i2c device in specified address on i2c bus /dev/i2c-1

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

Name returns the BeagleboneAdaptors name

func (*BeagleboneAdaptor) PwmWrite

func (b *BeagleboneAdaptor) PwmWrite(pin string, val byte) (err error)

PwmWrite writes the 0-254 value to the specified pin

func (*BeagleboneAdaptor) ServoWrite

func (b *BeagleboneAdaptor) ServoWrite(pin string, val byte) (err error)

ServoWrite writes the 0-180 degree val to the specified pin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL