2014-06-09 19:01:53 -07:00
# Firmata
2014-04-26 03:11:51 -07:00
2014-11-28 15:34:42 -08:00
Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments.
2014-07-06 14:17:10 -05:00
This package provides the adaptor for microcontrollers such as Arduino that support the [Firmata ](http://firmata.org/wiki/Main_Page ) protocol
2014-04-26 03:11:51 -07:00
2014-11-28 15:34:42 -08:00
For more info about the arduino platform click [here ](http://arduino.cc/ ).
## How to Install
2014-04-26 03:11:51 -07:00
2014-06-09 19:01:53 -07:00
```
2014-07-06 14:17:10 -05:00
go get github.com/hybridgroup/gobot & & go install github.com/hybridgroup/gobot/platforms/firmata
2014-06-09 19:01:53 -07:00
```
2014-04-26 03:11:51 -07:00
2014-11-28 15:34:42 -08:00
## How to Use
2014-04-26 03:11:51 -07:00
```go
package main
import (
2014-07-10 17:02:00 -07:00
"time"
2014-04-26 03:11:51 -07:00
"github.com/hybridgroup/gobot"
2014-06-09 19:01:53 -07:00
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
2014-04-26 03:11:51 -07:00
)
func main() {
2014-06-09 19:01:53 -07:00
gbot := gobot.NewGobot()
2014-07-10 17:02:00 -07:00
firmataAdaptor := firmata.NewFirmataAdaptor("arduino", "/dev/ttyACM0")
led := gpio.NewLedDriver(firmataAdaptor, "led", "13")
2014-04-26 03:11:51 -07:00
work := func() {
2014-06-09 19:01:53 -07:00
gobot.Every(1*time.Second, func() {
2014-04-26 03:11:51 -07:00
led.Toggle()
})
}
2014-07-10 17:02:00 -07:00
robot := gobot.NewRobot("bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{led},
work,
)
gbot.AddRobot(robot)
2014-06-09 19:01:53 -07:00
gbot.Start()
2014-04-26 03:11:51 -07:00
}
```
## 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-07-10 17:02:00 -07:00
More devices are coming soon...