1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-09 19:29:27 +08:00
2014-07-10 14:28:54 -07:00
..
2014-07-10 14:28:54 -07:00
2014-04-29 13:20:32 -07:00
2014-07-06 14:17:10 -05:00

Firmata

This package provides the adaptor for microcontrollers such as Arduino that support the Firmata protocol

Getting Started

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/firmata

Example

package main

import (
	"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")
	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()
}

Hardware Support

The following firmata devices have been tested and are currently supported:

More devices are coming soon...