hybridgroup.gobot/platforms/sphero/doc.go

43 lines
783 B
Go
Raw Normal View History

2014-10-22 01:15:32 +08:00
/*
2014-10-29 05:52:59 +08:00
Package sphero provides the Gobot adaptor and driver for the Sphero.
2014-10-22 01:15:32 +08:00
Installing:
go get gobot.io/x/gobot/platforms/sphero
2014-10-22 01:15:32 +08:00
Example:
package main
2014-10-22 01:15:32 +08:00
import (
"fmt"
"time"
2014-10-22 01:15:32 +08:00
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/sphero"
)
2014-10-22 01:15:32 +08:00
func main() {
adaptor := sphero.NewAdaptor("/dev/rfcomm0")
driver := sphero.NewSpheroDriver(adaptor)
2014-10-22 01:15:32 +08:00
work := func() {
gobot.Every(3*time.Second, func() {
driver.Roll(30, uint16(gobot.Rand(360)))
})
}
2014-10-22 01:15:32 +08:00
robot := gobot.NewRobot("sphero",
[]gobot.Connection{adaptor},
[]gobot.Device{driver},
work,
)
2014-10-22 01:15:32 +08:00
robot.Start()
}
2014-10-22 01:15:32 +08:00
2016-07-14 00:44:47 +08:00
For further information refer to sphero readme:
https://github.com/hybridgroup/gobot/blob/master/platforms/sphero/README.md
2014-10-22 01:15:32 +08:00
*/
package sphero // import "gobot.io/x/gobot/platforms/sphero"