hybridgroup.gobot/platforms/dexter/gopigo3
Ulises Flynn 180a7eebf8 revert back to int64 2018-06-25 10:58:41 -06:00
..
README.md gopigo3: integration of recent GoPiGo3 contributions 2017-09-14 14:30:27 +02:00
driver.go update gopigo3 with default spi values, cleanup 2018-06-22 21:10:33 -06:00
driver_test.go revert back to int64 2018-06-25 10:58:41 -06:00

README.md

GoPiGo3

The GoPiGo3 is a robotics controller by Dexter Industries that is compatible with the Raspberry Pi.

How to Install

go get -d -u gobot.io/x/gobot/...

How to Use

This example will blink the left and right leds red/blue.

package main

import (
	"fmt"
	"time"

	"gobot.io/x/gobot"
	g "gobot.io/x/gobot/platforms/dexter/gopigo3"
	"gobot.io/x/gobot/platforms/raspi"
)

func main() {
	raspiAdaptor := raspi.NewAdaptor()
	gopigo3 := g.NewDriver(raspiAdaptor)

	work := func() {
		on := uint8(0xFF)
		gobot.Every(1000*time.Millisecond, func() {
			err := gopigo3.SetLED(g.LED_EYE_RIGHT, 0x00, 0x00, on)
			if err != nil {
				fmt.Println(err)
			}
			err = gopigo3.SetLED(g.LED_EYE_LEFT, ^on, 0x00, 0x00)
			if err != nil {
				fmt.Println(err)
			}
			on = ^on
		})
	}

	robot := gobot.NewRobot("gopigo3",
		[]gobot.Connection{raspiAdaptor},
		[]gobot.Device{gopigo3},
		work,
	)

	robot.Start()
}