From cc8612bbcb1153c5b3f36eea1e564dc79a5ee77c Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Sun, 8 Jun 2014 19:37:41 -0700 Subject: [PATCH] Update sphero examples --- examples/sphero_api.go | 8 ++++---- examples/sphero_conways.go | 2 +- examples/sphero_master.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/sphero_api.go b/examples/sphero_api.go index 056a68de..8ffe00f2 100644 --- a/examples/sphero_api.go +++ b/examples/sphero_api.go @@ -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", diff --git a/examples/sphero_conways.go b/examples/sphero_conways.go index 839c1d22..f85d6405 100644 --- a/examples/sphero_conways.go +++ b/examples/sphero_conways.go @@ -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() }) diff --git a/examples/sphero_master.go b/examples/sphero_master.go index b52eef81..d4d364a4 100644 --- a/examples/sphero_master.go +++ b/examples/sphero_master.go @@ -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))) }) }, ))