v1.9.0 Latest Latest

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

Go to latest
Published: Feb 14, 2018 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0


Sphero BB-8

The Sphero BB-8 is a toy robot from Sphero that is controlled using Bluetooth LE. For more information, go to

How to Install

go get -d -u

How to Use

package main

import (


func main() {
	bleAdaptor := ble.NewClientAdaptor(os.Args[1])
	bb8 := bb8.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))
			bb8.SetRGB(r, g, b)

	robot := gobot.NewRobot("bb",


How to Connect

The Sphero BB-8 is a Bluetooth LE device.

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


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.

If you connect by name, then you do not need to worry about the Bluetooth LE ID. However, if you want to connect by ID, OS X 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.

For example:

GODEBUG=cgocheck=0 go run examples/bb8.go BB-1247

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/bb8.go
sudo ./bb8 BB-1247

Hopefully coming soon...



Package bb8 contains the Gobot driver for the Sphero BB-8.

For more information refer to the BB-8 README:



This section is empty.


This section is empty.


func DefaultCollisionConfig added in v1.7.1

func DefaultCollisionConfig() sphero.CollisionConfig

DefaultCollisionConfig returns a CollisionConfig with sensible collision defaults


type BB8Driver added in v1.1.0

type BB8Driver struct {

Driver represents a Sphero BB-8

func NewDriver added in v1.1.0

func NewDriver(a ble.BLEConnector) *BB8Driver

NewDriver creates a Driver for a Sphero BB-8

Jump to

Keyboard shortcuts

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