diff --git a/README.md b/README.md index 06e2ca48e..edcc023b9 100644 --- a/README.md +++ b/README.md @@ -18,28 +18,34 @@ Want to use Ruby or Javascript on robots? Check out our sister projects Artoo (h package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/firmata" - "github.com/hybridgroup/gobot/platforms/gpio" - "time" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/firmata" + "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { - gbot := gobot.NewGobot() + gbot := gobot.NewGobot() - adaptor := firmata.NewFirmataAdaptor("myFirmata", "/dev/ttyACM0") - led := gpio.NewLedDriver(adaptor, "myLed", "13") + firmataAdaptor := firmata.NewFirmataAdaptor("arduino", "/dev/ttyACM0") + led := gpio.NewLedDriver(firmataAdaptor, "led", "13") - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("blink", []gobot.Connection{adaptor}, []gobot.Device{led}, work)) + robot := gobot.NewRobot("bot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{led}, + work, + ) - gbot.Start() + gbot.AddRobot(robot) + + gbot.Start() } ``` @@ -49,27 +55,34 @@ func main() { package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/sphero" - "time" + "fmt" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/sphero" ) func main() { - gbot := gobot.NewGobot() + gbot := gobot.NewGobot() + + adaptor := sphero.NewSpheroAdaptor("sphero", "/dev/rfcomm0") + driver := sphero.NewSpheroDriver(adaptor, "sphero") - adaptor := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") - ball := sphero.NewSpheroDriver(adaptor, "sphero") + work := func() { + gobot.Every(3*time.Second, func() { + driver.Roll(30, uint16(gobot.Rand(360))) + }) + } - work := func() { - gobot.Every(3*time.Second, func() { - ball.Roll(30, uint16(gobot.Rand(360))) - }) - } + robot := gobot.NewRobot("sphero", + []gobot.Connection{adaptor}, + []gobot.Device{driver}, + work, + ) - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("sphero", []gobot.Connection{adaptor}, []gobot.Device{ball}, work)) + gbot.AddRobot(robot) - gbot.Start() + gbot.Start() } ``` @@ -121,14 +134,14 @@ Gobot includes a RESTful API to query the status of any robot running within a g To activate the API, require the `github.com/hybridgroup/gobot/api` package and instantiate the `API` like this: ```go - master := gobot.NewGobot() - api.NewAPI(master).Start() + gbot := gobot.NewGobot() + api.NewAPI(gbot).Start() ``` You can also specify the api host and port, and turn on authentication: ```go - master := gobot.NewGobot() - server := api.NewAPI(master) + gbot := gobot.NewGobot() + server := api.NewAPI(gbot) server.Port = "4000" server.Username = "Gort" server.Password = "klaatu" diff --git a/platforms/ardrone/README.md b/platforms/ardrone/README.md index 3436ecb72..c8c9ab4ff 100644 --- a/platforms/ardrone/README.md +++ b/platforms/ardrone/README.md @@ -16,28 +16,34 @@ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/p package main import ( + "time" + "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/ardrone" - "time" ) func main() { gbot := gobot.NewGobot() - adaptor := ardrone.NewArdroneAdaptor("Drone") - drone := ardrone.NewArdroneDriver(adaptor, "Drone") + + ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone") + drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone") work := func() { drone.TakeOff() - gobot.On(drone.Events["Flying"], func(data interface{}) { + gobot.On(drone.Event("flying"), func(data interface{}) { gobot.After(3*time.Second, func() { drone.Land() }) }) } - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("drone", []gobot.Connection{adaptor}, []gobot.Device{drone}, work)) + robot := gobot.NewRobot("drone", + []gobot.Connection{ardroneAdaptor}, + []gobot.Device{drone}, + work, + ) + gbot.AddRobot(robot) gbot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/beaglebone/README.md b/platforms/beaglebone/README.md index d7a4f2024..86565388f 100644 --- a/platforms/beaglebone/README.md +++ b/platforms/beaglebone/README.md @@ -34,26 +34,33 @@ $ ssh -t root@192.168.7.2 "./beaglebone_blink" package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/beaglebone" - "github.com/hybridgroup/gobot/platforms/gpio" - "time" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/beaglebone" + "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { - gbot := gobot.NewGobot() + gbot := gobot.NewGobot() + + beagleboneAdaptor := beaglebone.NewBeagleboneAdaptor("beaglebone") + led := gpio.NewLedDriver(beagleboneAdaptor, "led", "P9_12") - adaptor := beaglebone.NewBeagleboneAdaptor("beaglebone") - led := gpio.NewLedDriver(adaptor, "led", "P9_12") + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{beagleboneAdaptor}, + []gobot.Device{led}, + work, + ) - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("blinkBot", []gobot.Connection{adaptor}, []gobot.Device{led}, work)) - gbot.Start() + gbot.AddRobot(robot) + + gbot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/digispark/README.md b/platforms/digispark/README.md index ef7b08a6b..7703d1c37 100644 --- a/platforms/digispark/README.md +++ b/platforms/digispark/README.md @@ -32,28 +32,35 @@ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/p package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/digispark" - "github.com/hybridgroup/gobot/platforms/gpio" - "time" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/digispark" + "github.com/hybridgroup/gobot/platforms/gpio" ) func main() { - gbot := gobot.NewGobot() - adaptor := digispark.NewDigisparkAdaptor("Digispark") - led := gpio.NewLedDriver(adaptor, "led", "0") - - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } - - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("blinkBot", []gobot.Connection{adaptor}, []gobot.Device{led}, work)) - gbot.Start() -} + gbot := gobot.NewGobot() + + digisparkAdaptor := digispark.NewDigisparkAdaptor("Digispark") + led := gpio.NewLedDriver(digisparkAdaptor, "led", "0") + + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } + robot := gobot.NewRobot("blinkBot", + []gobot.Connection{digisparkAdaptor}, + []gobot.Device{led}, + work, + ) + + gbot.AddRobot(robot) + + gbot.Start() +} ``` ## Connecting to Digispark @@ -102,4 +109,4 @@ KERNEL=="ttyACM*", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="0753", MODE:="066 Thanks to [@bluebie](https://github.com/Bluebie) for these instructions! (https://github.com/Bluebie/micronucleus-t85/wiki/Ubuntu-Linux) -Now plug the Digispark into your computer via the USB port. \ No newline at end of file +Now plug the Digispark into your computer via the USB port. diff --git a/platforms/firmata/README.md b/platforms/firmata/README.md index 810498aaf..aee9e01a5 100644 --- a/platforms/firmata/README.md +++ b/platforms/firmata/README.md @@ -14,23 +14,33 @@ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/p package main import ( + "time" + "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/firmata" "github.com/hybridgroup/gobot/platforms/gpio" - "time" ) func main() { gbot := gobot.NewGobot() - adaptor := firmata.NewFirmataAdaptor("myFirmata", "/dev/ttyACM0") - led := gpio.NewLedDriver(adaptor, "myLed", "13") + + firmataAdaptor := firmata.NewFirmataAdaptor("arduino", "/dev/ttyACM0") + led := gpio.NewLedDriver(firmataAdaptor, "led", "13") + work := func() { gobot.Every(1*time.Second, func() { led.Toggle() }) } - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("blinkBot", []gobot.Connection{adaptor}, []gobot.Device{led}, work)) + + robot := gobot.NewRobot("bot", + []gobot.Connection{firmataAdaptor}, + []gobot.Device{led}, + work, + ) + + gbot.AddRobot(robot) + gbot.Start() } ``` @@ -40,4 +50,4 @@ The following firmata devices have been tested and are currently supported: - [Arduino uno r3](http://arduino.cc/en/Main/arduinoBoardUno) - [Teensy 3.0](http://www.pjrc.com/store/teensy3.html) -More devices are coming soon... \ No newline at end of file +More devices are coming soon... diff --git a/platforms/joystick/README.md b/platforms/joystick/README.md index 2d5eb7a17..2022a3f02 100644 --- a/platforms/joystick/README.md +++ b/platforms/joystick/README.md @@ -128,46 +128,56 @@ Controller configurations are stored in JSON format. Here's an example configura package main import ( - "fmt" - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/joystick" + "fmt" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/joystick" ) func main() { - gbot := gobot.NewGobot() - joystickAdaptor := joystick.NewJoystickAdaptor("ps3") - joystickDriver := joystick.NewJoystickDriver(joystickAdaptor, "ps3", "./platforms/joystick/configs/dualshock3.json") - - work := func() { - gobot.On(joystickDriver.Events["square_press"], func(data interface{}) { - fmt.Println("square_press") - }) - gobot.On(joystickDriver.Events["square_release"], func(data interface{}) { - fmt.Println("square_release") - }) - gobot.On(joystickDriver.Events["triangle_press"], func(data interface{}) { - fmt.Println("triangle_press") - }) - gobot.On(joystickDriver.Events["triangle_release"], func(data interface{}) { - fmt.Println("triangle_release") - }) - gobot.On(joystickDriver.Events["left_x"], func(data interface{}) { - fmt.Println("left_x", data) - }) - gobot.On(joystickDriver.Events["left_y"], func(data interface{}) { - fmt.Println("left_y", data) - }) - gobot.On(joystickDriver.Events["right_x"], func(data interface{}) { - fmt.Println("right_x", data) - }) - gobot.On(joystickDriver.Events["right_y"], func(data interface{}) { - fmt.Println("right_y", data) - }) - } - - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("joystickBot", []gobot.Connection{joystickAdaptor}, []gobot.Device{joystickDriver}, work)) - - gbot.Start() + gbot := gobot.NewGobot() + + joystickAdaptor := joystick.NewJoystickAdaptor("ps3") + joystick := joystick.NewJoystickDriver(joystickAdaptor, + "ps3", + "./platforms/joystick/configs/dualshock3.json", + ) + + work := func() { + gobot.On(joystick.Event("square_press"), func(data interface{}) { + fmt.Println("square_press") + }) + gobot.On(joystick.Event("square_release"), func(data interface{}) { + fmt.Println("square_release") + }) + gobot.On(joystick.Event("triangle_press"), func(data interface{}) { + fmt.Println("triangle_press") + }) + gobot.On(joystick.Event("triangle_release"), func(data interface{}) { + fmt.Println("triangle_release") + }) + gobot.On(joystick.Event("left_x"), func(data interface{}) { + fmt.Println("left_x", data) + }) + gobot.On(joystick.Event("left_y"), func(data interface{}) { + fmt.Println("left_y", data) + }) + gobot.On(joystick.Event("right_x"), func(data interface{}) { + fmt.Println("right_x", data) + }) + gobot.On(joystick.Event("right_y"), func(data interface{}) { + fmt.Println("right_y", data) + }) + } + + robot := gobot.NewRobot("joystickBot", + []gobot.Connection{joystickAdaptor}, + []gobot.Device{joystick}, + work, + ) + + gbot.AddRobot(robot) + + gbot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/leap/README.md b/platforms/leap/README.md index c4b3c4b70..1d9fd0adf 100644 --- a/platforms/leap/README.md +++ b/platforms/leap/README.md @@ -18,24 +18,31 @@ package main import ( "fmt" + "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/leap" ) func main() { gbot := gobot.NewGobot() - adaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437") - l := leap.NewLeapMotionDriver(adaptor, "leap") + + leapMotionAdaptor := leap.NewLeapMotionAdaptor("leap", "127.0.0.1:6437") + l := leap.NewLeapMotionDriver(leapMotionAdaptor, "leap") work := func() { - gobot.On(l.Events["Message"], func(data interface{}) { + gobot.On(l.Event("message"), func(data interface{}) { fmt.Println(data.(leap.Frame)) }) } - gbot.Robots = append(gbot.Robots, gobot.NewRobot( - "leapBot", []gobot.Connection{adaptor}, []gobot.Device{l}, work)) + robot := gobot.NewRobot("leapBot", + []gobot.Connection{leapMotionAdaptor}, + []gobot.Device{l}, + work, + ) + + gbot.AddRobot(robot) gbot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/neurosky/README.md b/platforms/neurosky/README.md index 6f9251160..a709ef1cb 100644 --- a/platforms/neurosky/README.md +++ b/platforms/neurosky/README.md @@ -41,56 +41,62 @@ You should be able to pair your Mindwave using your normal system tray applet fo ## Examples ```go -package main + import ( - "fmt" - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/neurosky" + "fmt" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/neurosky" ) func main() { - gbot := gobot.NewGobot() - - adaptor := neurosky.NewNeuroskyAdaptor("neurosky", "/dev/rfcomm0") - neuro := neurosky.NewNeuroskyDriver(adaptor, "neuro") - - work := func() { - gobot.On(neuro.Events["Extended"], func(data interface{}) { - fmt.Println("Extended", data) - }) - gobot.On(neuro.Events["Signal"], func(data interface{}) { - fmt.Println("Signal", data) - }) - gobot.On(neuro.Events["Attention"], func(data interface{}) { - fmt.Println("Attention", data) - }) - gobot.On(neuro.Events["Meditation"], func(data interface{}) { - fmt.Println("Meditation", data) - }) - gobot.On(neuro.Events["Blink"], func(data interface{}) { - fmt.Println("Blink", data) - }) - gobot.On(neuro.Events["Wave"], func(data interface{}) { - fmt.Println("Wave", data) - }) - gobot.On(neuro.Events["EEG"], func(data interface{}) { - eeg := data.(gobotNeurosky.EEG)kj - fmt.Println("Delta", eeg.Delta) - fmt.Println("Theta", eeg.Theta) - fmt.Println("LoAlpha", eeg.LoAlpha) - fmt.Println("HiAlpha", eeg.HiAlpha) - fmt.Println("LoBeta", eeg.LoBeta) - fmt.Println("HiBeta", eeg.HiBeta) - fmt.Println("LoGamma", eeg.LoGamma) - fmt.Println("MidGamma", eeg.MidGamma) - fmt.Println("\n") - }) - } - - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("brainBot", []gobot.Connection{adaptor}, []gobot.Device{neuro}, work)) - - gbot.Start() + gbot := gobot.NewGobot() + + adaptor := neurosky.NewNeuroskyAdaptor("neurosky", "/dev/rfcomm0") + neuro := neurosky.NewNeuroskyDriver(adaptor, "neuro") + + work := func() { + gobot.On(neuro.Event("extended"), func(data interface{}) { + fmt.Println("Extended", data) + }) + gobot.On(neuro.Event("signal"), func(data interface{}) { + fmt.Println("Signal", data) + }) + gobot.On(neuro.Event("attention"), func(data interface{}) { + fmt.Println("Attention", data) + }) + gobot.On(neuro.Event("meditation"), func(data interface{}) { + fmt.Println("Meditation", data) + }) + gobot.On(neuro.Event("blink"), func(data interface{}) { + fmt.Println("Blink", data) + }) + gobot.On(neuro.Event("wave"), func(data interface{}) { + fmt.Println("Wave", data) + }) + gobot.On(neuro.Event("eeg"), func(data interface{}) { + eeg := data.(neurosky.EEG) + fmt.Println("Delta", eeg.Delta) + fmt.Println("Theta", eeg.Theta) + fmt.Println("LoAlpha", eeg.LoAlpha) + fmt.Println("HiAlpha", eeg.HiAlpha) + fmt.Println("LoBeta", eeg.LoBeta) + fmt.Println("HiBeta", eeg.HiBeta) + fmt.Println("LoGamma", eeg.LoGamma) + fmt.Println("MidGamma", eeg.MidGamma) + fmt.Println("\n") + }) + } + + robot := gobot.NewRobot("brainBot", + []gobot.Connection{adaptor}, + []gobot.Device{neuro}, + work, + ) + + gbot.AddRobot(robot) + gbot.Start() } + ``` diff --git a/platforms/opencv/README.md b/platforms/opencv/README.md index 3e6b9d544..88515076c 100644 --- a/platforms/opencv/README.md +++ b/platforms/opencv/README.md @@ -45,13 +45,17 @@ func main() { camera := opencv.NewCameraDriver("camera", 0) work := func() { - gobot.On(camera.Events["Frame"], func(data interface{}) { + gobot.On(camera.Event("frame"), func(data interface{}) { window.ShowImage(data.(*cv.IplImage)) }) } - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("cameraBot", []gobot.Connection{}, []gobot.Device{window, camera}, work)) + robot := gobot.NewRobot("cameraBot", + []gobot.Device{window, camera}, + work, + ) + + gbot.AddRobot(robot) gbot.Start() } diff --git a/platforms/pebble/README.md b/platforms/pebble/README.md index 4f9557016..575dd04e8 100644 --- a/platforms/pebble/README.md +++ b/platforms/pebble/README.md @@ -11,7 +11,6 @@ has been installed on the Pebble watch. For more information about Gobot, check out the github repo at https://github.com/hybridgroup/gobot -[![Build Status](https://secure.travis-ci.org/hybridgroup/gobot-pebble.png?branch=master)](http://travis-ci.org/hybridgroup/gobot-pebble) ## Installing @@ -25,39 +24,46 @@ https://github.com/hybridgroup/gobot in example, api host is your computer IP, robot name is 'pebble', robot api port is 8080 and publish command is PublishEventC and message command is PendingMessageC -``` +```go package main import ( "fmt" + "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/api" "github.com/hybridgroup/gobot/platforms/pebble" ) func main() { - master := gobot.NewGobot() - api.NewAPI(master).Start() + gbot := gobot.NewGobot() + api.NewAPI(gbot).Start() pebbleAdaptor := pebble.NewPebbleAdaptor("pebble") pebbleDriver := pebble.NewPebbleDriver(pebbleAdaptor, "pebble") work := func() { pebbleDriver.SendNotification("Hello Pebble!") - gobot.On(pebbleDriver.Events["button"], func(data interface{}) { + gobot.On(pebbleDriver.Event("button"), func(data interface{}) { fmt.Println("Button pushed: " + data.(string)) }) - gobot.On(pebbleDriver.Events["tap"], func(data interface{}) { + gobot.On(pebbleDriver.Event("tap"), func(data interface{}) { fmt.Println("Tap event detected") }) } - robot := gobot.NewRobot("pebble", []gobot.Connection{pebbleAdaptor}, []gobot.Device{pebbleDriver}, work) + robot := gobot.NewRobot("pebble", + []gobot.Connection{pebbleAdaptor}, + []gobot.Device{pebbleDriver}, + work, + ) - master.Robots = append(master.Robots, robot) - master.Start() + gbot.AddRobot(robot) + + gbot.Start() } + ``` ## Supported Features diff --git a/platforms/spark/README.md b/platforms/spark/README.md index 7c835692d..ef44489f6 100644 --- a/platforms/spark/README.md +++ b/platforms/spark/README.md @@ -13,27 +13,33 @@ go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/p package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/gpio" - "github.com/hybridgroup/gobot/platforms/spark" - "time" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/gpio" + "github.com/hybridgroup/gobot/platforms/spark" ) func main() { - master := gobot.NewGobot() + gbot := gobot.NewGobot() + + sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") + led := gpio.NewLedDriver(sparkCore, "led", "D7") - sparkCore := spark.NewSparkCoreAdaptor("spark", "device_id", "access_token") - led := gpio.NewLedDriver(sparkCore, "led", "D7") + work := func() { + gobot.Every(1*time.Second, func() { + led.Toggle() + }) + } - work := func() { - gobot.Every(1*time.Second, func() { - led.Toggle() - }) - } + robot := gobot.NewRobot("spark", + []gobot.Connection{sparkCore}, + []gobot.Device{led}, + work, + ) - master.Robots = append(master.Robots, - gobot.NewRobot("spark", []gobot.Connection{sparkCore}, []gobot.Device{led}, work)) + gbot.AddRobot(robot) - master.Start() + gbot.Start() } -``` \ No newline at end of file +``` diff --git a/platforms/sphero/README.md b/platforms/sphero/README.md index 9c7397f51..51a71a56d 100644 --- a/platforms/sphero/README.md +++ b/platforms/sphero/README.md @@ -44,26 +44,33 @@ You should be able to pair your Sphero using your normal system tray applet for package main import ( - "github.com/hybridgroup/gobot" - "github.com/hybridgroup/gobot/platforms/sphero" - "time" + "fmt" + "time" + + "github.com/hybridgroup/gobot" + "github.com/hybridgroup/gobot/platforms/sphero" ) func main() { - gbot := gobot.NewGobot() + gbot := gobot.NewGobot() + + adaptor := sphero.NewSpheroAdaptor("sphero", "/dev/rfcomm0") + driver := sphero.NewSpheroDriver(adaptor, "sphero") - adaptor := sphero.NewSpheroAdaptor("Sphero", "/dev/rfcomm0") - ball := sphero.NewSpheroDriver(adaptor, "sphero") + work := func() { + gobot.Every(3*time.Second, func() { + driver.Roll(30, uint16(gobot.Rand(360))) + }) + } - work := func() { - gobot.Every(3*time.Second, func() { - ball.Roll(30, uint16(gobot.Rand(360))) - }) - } + robot := gobot.NewRobot("sphero", + []gobot.Connection{adaptor}, + []gobot.Device{driver}, + work, + ) - gbot.Robots = append(gbot.Robots, - gobot.NewRobot("sphero", []gobot.Connection{adaptor}, []gobot.Device{ball}, work)) + gbot.AddRobot(robot) - gbot.Start() + gbot.Start() } -``` \ No newline at end of file +```