Update sphero examples
This commit is contained in:
parent
6e0126698e
commit
cc8612bbcb
|
@ -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",
|
||||
|
|
|
@ -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()
|
||||
})
|
||||
|
||||
|
|
|
@ -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)))
|
||||
})
|
||||
},
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue