v0.12.0 Latest Latest

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

Go to latest
Published: Jul 13, 2016 License: Apache-2.0 Imports: 5 Imported by: 0



The CHIP is a small, inexpensive ARM based single board computer, with many different IO interfaces available on the pin headers.

For documentation about the CHIP platform click here.

How to Install

go get -d -u && go install

Cross compiling for the CHIP

If you're using Go version earlier than 1.5, you must first configure your Go environment for ARM linux cross compiling.

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

The above step is not required for Go >= 1.5

Then compile your Gobot program with

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

Then you can simply upload your program to the CHIP and execute it with

$ scp chip_button root@192.168.1.xx:
$ ssh -t root@192.168.1.xx "./chip_button"

How to Use

package main

import (


func main() {
    gbot := gobot.NewGobot()

    chipAdaptor := chip.NewChipAdaptor("chip")
    button := gpio.NewButtonDriver(chipAdaptor, "button", "XIO-P0")

    work := func() {
        gobot.On(button.Event("push"), func(data interface{}) {
            fmt.Println("button pressed")

        gobot.On(button.Event("release"), func(data interface{}) {
            fmt.Println("button released")

    robot := gobot.NewRobot("buttonBot",



Package chip contains the Gobot adaptor for the CHIP

For further information refer to the chip README:



This section is empty.


This section is empty.


This section is empty.


type ChipAdaptor

type ChipAdaptor struct {
	// contains filtered or unexported fields

func NewChipAdaptor

func NewChipAdaptor(name string) *ChipAdaptor

NewChipAdaptor creates a ChipAdaptor with the specified name

func (*ChipAdaptor) Connect

func (c *ChipAdaptor) Connect() (errs []error)

Connect initializes the board

func (*ChipAdaptor) DigitalRead

func (c *ChipAdaptor) DigitalRead(pin string) (val int, err error)

DigitalRead reads digital value from the specified pin. Valids pins are XIO-P0 through XIO-P7 (pins 13-20 on header 14).

func (*ChipAdaptor) DigitalWrite

func (c *ChipAdaptor) DigitalWrite(pin string, val byte) (err error)

DigitalWrite writes digital value to the specified pin. Valids pins are XIO-P0 through XIO-P7 (pins 13-20 on header 14).

func (*ChipAdaptor) Finalize

func (c *ChipAdaptor) Finalize() (errs []error)

Finalize closes connection to board and pins

func (*ChipAdaptor) I2cRead

func (c *ChipAdaptor) I2cRead(address int, size int) (data []byte, err error)

I2cRead returns value from i2c device using specified size

func (*ChipAdaptor) I2cStart

func (c *ChipAdaptor) I2cStart(address int) (err error)

I2cStart starts an i2c device in specified address. This assumes that the bus used is /dev/i2c-1, which corresponds to pins labeled TWI1-SDA and TW1-SCK (pins 9 and 11 on header 13).

func (*ChipAdaptor) I2cWrite

func (c *ChipAdaptor) I2cWrite(address int, data []byte) (err error)

I2cWrite writes data to i2c device

func (*ChipAdaptor) Name

func (c *ChipAdaptor) Name() string

Name returns the name of the ChipAdaptor

Jump to

Keyboard shortcuts

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