SPRK+
Allows user to send commands to Sphero SPRK+. API Reference
How To Connect
The Sphero SPRK+ is a Bluetooth LE device. You need to know the BLE ID of the SPRK+ you want to connect to. The Gobot BLE client adaptor also lets you connect by friendly name, aka "SPRK+247".
import ( "gobot.io/x/gobot/platforms/ble" "gobot.io/x/gobot/platforms/sphero/sprkplus" ) bleAdaptor := ble.NewClientAdaptor(os.Args[1]) sprk := sprkplus.NewDriver(bleAdaptor) ...
How To Use
package main import ( "os" "time" "gobot.io/x/gobot" "gobot.io/x/gobot/platforms/ble" "gobot.io/x/gobot/platforms/sphero/sprkplus" ) func main() { bleAdaptor := ble.NewClientAdaptor(os.Args[1]) sprk := sprkplus.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("sprkie", []gobot.Connection{bleAdaptor}, []gobot.Device{sprk}, work, ) robot.Start() }