hybridgroup.gobot/platforms/firmata/README.md

43 lines
1.1 KiB
Markdown
Raw Normal View History

2014-06-10 10:01:53 +08:00
# Firmata
2014-07-07 03:17:10 +08:00
This package provides the adaptor for microcontrollers such as Arduino that support the [Firmata](http://firmata.org/wiki/Main_Page) protocol
## Getting Started
2014-06-10 10:01:53 +08:00
```
2014-07-07 03:17:10 +08:00
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/firmata
2014-06-10 10:01:53 +08:00
```
## Example
```go
package main
import (
"github.com/hybridgroup/gobot"
2014-06-10 10:01:53 +08:00
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
"time"
)
func main() {
2014-06-10 10:01:53 +08:00
gbot := gobot.NewGobot()
adaptor := firmata.NewFirmataAdaptor("myFirmata", "/dev/ttyACM0")
led := gpio.NewLedDriver(adaptor, "myLed", "13")
work := func() {
2014-06-10 10:01:53 +08:00
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
2014-06-10 10:01:53 +08:00
gbot.Robots = append(gbot.Robots,
gobot.NewRobot("blinkBot", []gobot.Connection{adaptor}, []gobot.Device{led}, work))
gbot.Start()
}
```
## Hardware Support
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)
2014-06-10 10:01:53 +08:00
More devices are coming soon...