Skip to content

Commit

Permalink
Update READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Jul 11, 2014
1 parent 129bb70 commit 1d24bd8
Show file tree
Hide file tree
Showing 12 changed files with 304 additions and 215 deletions.
79 changes: 46 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
```

Expand All @@ -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()
}
```

Expand Down Expand Up @@ -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"
Expand Down
20 changes: 13 additions & 7 deletions platforms/ardrone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
```
```
39 changes: 23 additions & 16 deletions platforms/beaglebone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,33 @@ $ ssh -t [email protected] "./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()
}
```
```
45 changes: 26 additions & 19 deletions platforms/digispark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Now plug the Digispark into your computer via the USB port.
22 changes: 16 additions & 6 deletions platforms/firmata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
```
Expand All @@ -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...
More devices are coming soon...
Loading

0 comments on commit 1d24bd8

Please sign in to comment.