Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Dec 30, 2013
1 parent 2e5c745 commit 5deff8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 29 deletions.
17 changes: 2 additions & 15 deletions examples/blink.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot-firmata"
"github.com/hybridgroup/gobot-gpio"
Expand All @@ -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,
}

Expand Down
11 changes: 2 additions & 9 deletions examples/sphero.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,15 @@ 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)))
})
}

robot := gobot.Robot{
Connections: connections,
Devices: devices,
Connections: []gobot.Connection{spheroAdaptor},
Devices: []gobot.Device{sphero},
Work: work,
}

Expand Down
6 changes: 3 additions & 3 deletions examples/sphero_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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},
})
Expand Down
4 changes: 2 additions & 2 deletions examples/sphero_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
Expand Down

0 comments on commit 5deff8d

Please sign in to comment.