beaglebone

package
v0.0.0-...-21b411a Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2014 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
}

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

Jump to

Keyboard shortcuts

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