Update sphero examples

This commit is contained in:
Adrian Zankich 2014-06-08 19:37:41 -07:00
parent 6e0126698e
commit cc8612bbcb
3 changed files with 6 additions and 6 deletions

View File

@ -6,17 +6,17 @@ import (
"github.com/hybridgroup/gobot/platforms/sphero"
)
var Master gobot.Gobot
var Master *gobot.Gobot
func TurnBlue(params map[string]interface{}) bool {
spheroDriver := Master.FindRobotDevice(params["robotname"].(string), "sphero")
gobot.Call(sphero.Driver, "SetRGB", uint8(0), uint8(0), uint8(255))
s := Master.Robot(params["robotname"].(string)).Device("sphero")
gobot.Call(s.Driver, "SetRGB", uint8(0), uint8(0), uint8(255))
return true
}
func main() {
Master = gobot.NewGobot()
api.Api(Master).Start()
api.NewApi(Master).Start()
spheros := map[string]string{
"Sphero-BPO": "/dev/rfcomm0",

View File

@ -35,7 +35,7 @@ func main() {
conway.birth()
gobot.On(sphero.Events["Collision"], func(data interface{}) {
gobot.On(cell.Events["Collision"], func(data interface{}) {
conway.contact()
})

View File

@ -32,7 +32,7 @@ func main() {
nil,
func() {
gobot.Every(1*time.Second, func() {
gobot.Call(master.FindRobot("Sphero-BPO").GetDevice("spheroDriver").Driver, "SetRGB", uint8(gobot.Rand(255)), uint8(gobot.Rand(255)), uint8(gobot.Rand(255)))
gobot.Call(master.Robot("Sphero-BPO").Device("sphero").Driver, "SetRGB", uint8(gobot.Rand(255)), uint8(gobot.Rand(255)), uint8(gobot.Rand(255)))
})
},
))