hybridgroup.gobot/platforms/sphero/ollie
deadprogram eff58377af ollie: correct race condition error on seq
Signed-off-by: deadprogram <ron@hybridgroup.com>
2017-04-05 13:21:26 +02:00
..
LICENSE license: update license year to include 2017 2017-01-02 22:25:17 +01:00
README.md docs: Update godocs for Sphero Ollie 2016-12-19 16:07:11 +01:00
doc.go docs: correct Ollie README link 2016-12-21 10:55:51 +01:00
helpers_test.go ollie: refactoring to use BLEConnector interface and provide tests 2017-04-05 12:57:50 +02:00
ollie_driver.go ollie: correct race condition error on seq 2017-04-05 13:21:26 +02:00
ollie_driver_test.go ollie: refactoring to use BLEConnector interface and provide tests 2017-04-05 12:57:50 +02:00
ollie_packets.go bb8: Added support for collision detection in ollie/bb8 2017-01-24 16:20:02 -05:00

README.md

Sphero Ollie

The Sphero Ollie is a toy robot from Sphero that is controlled using Bluetooth LE. For more information, go to http://www.sphero.com/ollie

How to Install

go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/ble

How to Use

package main

import (
	"os"
	"time"

	"gobot.io/x/gobot"
	"gobot.io/x/gobot/platforms/ble"
	"gobot.io/x/gobot/platforms/sphero/ollie"
)

func main() {
	bleAdaptor := ble.NewClientAdaptor(os.Args[1])
	ollie := ollie.NewDriver(bleAdaptor)

	work := func() {
		gobot.Every(1*time.Second, func() {
			r := uint8(gobot.Rand(255))
			g := uint8(gobot.Rand(255))
			b := uint8(gobot.Rand(255))
			ollie.SetRGB(r, g, b)
		})
	}

	robot := gobot.NewRobot("ollieBot",
		[]gobot.Connection{bleAdaptor},
		[]gobot.Device{ollie},
		work,
	)

	robot.Start()
}

How to Connect

The Sphero Ollie is a Bluetooth LE device.

You need to know the BLE ID of the Ollie you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "2B-1247".

OSX

To run any of the Gobot BLE code you must use the GODEBUG=cgocheck=0 flag in order to get around some of the issues in the CGo-based implementation.

For example:

GODEBUG=cgocheck=0 go run examples/ollie.go 2B-1247

OSX uses its own Bluetooth ID system which is different from the IDs used on Linux. The code calls thru the XPC interfaces provided by OSX, so as a result does not need to run under sudo.

Ubuntu

On Linux the BLE code will need to run as a root user account. The easiest way to accomplish this is probably to use go build to build your program, and then to run the requesting executable using sudo.

For example:

go build examples/ollie.go
sudo ./minidrone 2B-1247

Windows

Hopefully coming soon...