1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-11 19:29:20 +08:00
deadprogram 7136bfcba7 core: Refactor Sphero platform for new Adaptor/Driver creation signatures
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-10-01 18:52:58 +02:00

47 lines
824 B
Go

/*
Package sphero provides the Gobot adaptor and driver for the Sphero.
Installing:
go get github.com/hybridgroup/gobot/platforms/sphero
Example:
package main
import (
"fmt"
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/sphero"
)
func main() {
gbot := gobot.NewGobot()
adaptor := sphero.NewAdaptor("/dev/rfcomm0")
driver := sphero.NewSpheroDriver(adaptor)
work := func() {
gobot.Every(3*time.Second, func() {
driver.Roll(30, uint16(gobot.Rand(360)))
})
}
robot := gobot.NewRobot("sphero",
[]gobot.Connection{adaptor},
[]gobot.Device{driver},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}
For further information refer to sphero readme:
https://github.com/hybridgroup/gobot/blob/master/platforms/sphero/README.md
*/
package sphero