From 5deff8dfed13193529d4044b18a8ff80bc881219 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Mon, 30 Dec 2013 13:56:16 -0800 Subject: [PATCH] Update examples --- examples/blink.go | 17 ++--------------- examples/sphero.go | 11 ++--------- examples/sphero_api.go | 6 +++--- examples/sphero_master.go | 4 ++-- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/examples/blink.go b/examples/blink.go index fa1544cb..df262dfb 100644 --- a/examples/blink.go +++ b/examples/blink.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot-firmata" "github.com/hybridgroup/gobot-gpio" @@ -17,27 +16,15 @@ func main() { led.Name = "led" led.Pin = "13" - connections := []interface{}{ - firmata, - } - devices := []interface{}{ - led, - } - work := func() { gobot.Every("1s", func() { led.Toggle() - if led.IsOn() { - fmt.Println("On") - } else { - fmt.Println("Off") - } }) } robot := gobot.Robot{ - Connections: connections, - Devices: devices, + Connections: []gobot.Connection{firmata}, + Devices: []gobot.Device{led}, Work: work, } diff --git a/examples/sphero.go b/examples/sphero.go index 069d0a1f..d6dedc00 100644 --- a/examples/sphero.go +++ b/examples/sphero.go @@ -14,13 +14,6 @@ func main() { sphero := gobotSphero.NewSphero(spheroAdaptor) sphero.Name = "Sphero" - connections := []interface{}{ - spheroAdaptor, - } - devices := []interface{}{ - sphero, - } - work := func() { gobot.Every("2s", func() { sphero.Roll(100, uint16(gobot.Rand(360))) @@ -28,8 +21,8 @@ func main() { } robot := gobot.Robot{ - Connections: connections, - Devices: devices, + Connections: []gobot.Connection{spheroAdaptor}, + Devices: []gobot.Device{sphero}, Work: work, } diff --git a/examples/sphero_api.go b/examples/sphero_api.go index ae111077..d66bd1c6 100644 --- a/examples/sphero_api.go +++ b/examples/sphero_api.go @@ -17,7 +17,7 @@ func main() { gobot.Api(Master) spheros := map[string]string{ - "Sphero-BPO": "127.0.0.1:4560", + "Sphero-BPO": "/dev/rfcomm0", } for name, port := range spheros { @@ -35,8 +35,8 @@ func main() { Master.Robots = append(Master.Robots, gobot.Robot{ Name: name, - Connections: []interface{}{spheroAdaptor}, - Devices: []interface{}{sphero}, + Connections: []gobot.Connection{spheroAdaptor}, + Devices: []gobot.Device{sphero}, Work: work, Commands: map[string]interface{}{"TurnBlue": TurnBlue}, }) diff --git a/examples/sphero_master.go b/examples/sphero_master.go index 84dcab04..1d60f9b3 100644 --- a/examples/sphero_master.go +++ b/examples/sphero_master.go @@ -27,8 +27,8 @@ func main() { master.Robots = append(master.Robots, gobot.Robot{ Name: name, - Connections: []interface{}{spheroAdaptor}, - Devices: []interface{}{sphero}, + Connections: []gobot.Connection{spheroAdaptor}, + Devices: []gobot.Device{sphero}, Work: work, }) }