beaglebone

package
v0.0.0-...-1595f01 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2014 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

README

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

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 {
	gobot.Adaptor
	// 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) int

AnalogRead returns an analog value from specified pin

func (*BeagleboneAdaptor) AnalogWrite

func (b *BeagleboneAdaptor) AnalogWrite(pin string, val byte)

AnalogWrite writes an analog value to specified pin

func (*BeagleboneAdaptor) Connect

func (b *BeagleboneAdaptor) Connect() bool

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) (i int)

DigitalRead returns a digital value from specified pin

func (*BeagleboneAdaptor) DigitalWrite

func (b *BeagleboneAdaptor) DigitalWrite(pin string, val byte)

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

Finalize returns true when board connection is finalized correctly.

func (*BeagleboneAdaptor) I2cRead

func (b *BeagleboneAdaptor) I2cRead(size uint) []byte

I2cRead returns value from i2c device using specified size

func (*BeagleboneAdaptor) I2cStart

func (b *BeagleboneAdaptor) I2cStart(address byte)

I2cStart starts a i2c device in specified address

func (*BeagleboneAdaptor) I2cWrite

func (b *BeagleboneAdaptor) I2cWrite(data []byte)

I2CWrite writes data to i2c device

func (*BeagleboneAdaptor) InitServo

func (b *BeagleboneAdaptor) InitServo()

InitServo starts servo (not yet implemented)

func (*BeagleboneAdaptor) PwmWrite

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

PwmWrite writes value in specified pin

func (*BeagleboneAdaptor) ServoWrite

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

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