1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-26 13:48:49 +08:00
hybridgroup.gobot/examples/ollie_roll.go
deadprogram 5b29de3ff7 [ble] Speed up Ollie example roll speed
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-07-11 23:47:19 -06:00

34 lines
558 B
Go

package main
import (
"os"
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/ble"
)
func main() {
gbot := gobot.NewGobot()
bleAdaptor := ble.NewBLEClientAdaptor("ble", os.Args[1])
ollie := ble.NewSpheroOllieDriver(bleAdaptor, "ollie")
work := func() {
ollie.SetRGB(255, 0, 255)
gobot.Every(3*time.Second, func() {
ollie.Roll(40, uint16(gobot.Rand(360)))
})
}
robot := gobot.NewRobot("ollieBot",
[]gobot.Connection{bleAdaptor},
[]gobot.Device{ollie},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}