From 6f14570641ef095fb3bcea17699e7d769ba3f6f8 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Fri, 6 Jun 2014 13:18:07 -0700 Subject: [PATCH] Fix broken examples --- examples/beaglebone_led_brightness.go | 2 +- examples/firmata_cat_toy.go | 2 +- examples/neurosky.go | 4 ++-- examples/opencv_window.go | 2 +- examples/sphero_api.go | 3 ++- examples/sphero_master.go | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) mode change 100644 => 100755 examples/sphero_api.go mode change 100644 => 100755 examples/sphero_master.go diff --git a/examples/beaglebone_led_brightness.go b/examples/beaglebone_led_brightness.go index 20c28f46..a4ead71f 100644 --- a/examples/beaglebone_led_brightness.go +++ b/examples/beaglebone_led_brightness.go @@ -16,7 +16,7 @@ func main() { brightness := uint8(0) fade_amount := uint8(5) - gobot.Every(0.1*time.Second, func() { + gobot.Every(100*time.Millisecond, func() { led.Brightness(brightness) brightness = brightness + fade_amount if brightness == 0 || brightness == 255 { diff --git a/examples/firmata_cat_toy.go b/examples/firmata_cat_toy.go index cd5aad87..1f8c7f3d 100644 --- a/examples/firmata_cat_toy.go +++ b/examples/firmata_cat_toy.go @@ -3,8 +3,8 @@ package main import ( "fmt" "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/gpio" "github.com/hybridgroup/gobot/platforms/firmata" + "github.com/hybridgroup/gobot/platforms/gpio" "github.com/hybridgroup/gobot/platforms/leap" "time" ) diff --git a/examples/neurosky.go b/examples/neurosky.go index b89cc070..2dc399c1 100644 --- a/examples/neurosky.go +++ b/examples/neurosky.go @@ -45,8 +45,8 @@ func main() { }) } - gbot.Robots := append(gbot.Robots, - gobot.NewRobot("brainBot",[]gobot.Connection{adaptor},[]gobot.Device{neuro},work)) + gbot.Robots = append(gbot.Robots, + gobot.NewRobot("brainBot", []gobot.Connection{adaptor}, []gobot.Device{neuro}, work)) gbot.Start() } diff --git a/examples/opencv_window.go b/examples/opencv_window.go index 13cdc810..6662c0f6 100644 --- a/examples/opencv_window.go +++ b/examples/opencv_window.go @@ -21,5 +21,5 @@ func main() { gbot.Robots = append(gbot.Robots, gobot.NewRobot("cameraBot", []gobot.Connection{}, []gobot.Device{window, camera}, work)) - gbot.Start()} + gbot.Start() } diff --git a/examples/sphero_api.go b/examples/sphero_api.go old mode 100644 new mode 100755 index 47006a8b..056a68de --- a/examples/sphero_api.go +++ b/examples/sphero_api.go @@ -6,7 +6,7 @@ import ( "github.com/hybridgroup/gobot/platforms/sphero" ) -Master := gobot.NewGobot() +var Master gobot.Gobot func TurnBlue(params map[string]interface{}) bool { spheroDriver := Master.FindRobotDevice(params["robotname"].(string), "sphero") @@ -15,6 +15,7 @@ func TurnBlue(params map[string]interface{}) bool { } func main() { + Master = gobot.NewGobot() api.Api(Master).Start() spheros := map[string]string{ diff --git a/examples/sphero_master.go b/examples/sphero_master.go old mode 100644 new mode 100755 index b185d961..b52eef81 --- a/examples/sphero_master.go +++ b/examples/sphero_master.go @@ -27,7 +27,7 @@ func main() { } master.Robots = append(master.Robots, gobot.NewRobot( - "" + "", nil, nil, func() {