2014-10-17 12:42:07 -05:00
|
|
|
/*
|
2014-10-28 14:52:59 -07:00
|
|
|
Package firmata provides the Gobot adaptor for microcontrollers that support the Firmata protocol.
|
2014-10-17 12:42:07 -05:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
2023-05-20 14:25:21 +02:00
|
|
|
go get -d -u gobot.io/x/gobot/v2/... && go get gobot.io/x/gobot/v2/platforms/firmata
|
2014-10-17 12:42:07 -05:00
|
|
|
|
2015-01-02 07:57:13 -08:00
|
|
|
Example:
|
2014-10-17 12:42:07 -05:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2023-05-20 14:25:21 +02:00
|
|
|
"gobot.io/x/gobot/v2"
|
|
|
|
"gobot.io/x/gobot/v2/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/firmata"
|
2014-10-17 12:42:07 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-09-25 20:49:20 +02:00
|
|
|
firmataAdaptor := firmata.NewAdaptor("/dev/ttyACM0")
|
|
|
|
led := gpio.NewLedDriver(firmataAdaptor, "13")
|
2014-10-17 12:42:07 -05:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("bot",
|
|
|
|
[]gobot.Connection{firmataAdaptor},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-18 21:37:10 +02:00
|
|
|
robot.Start()
|
2014-10-17 12:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to firmata readme:
|
2016-12-21 10:51:54 +01:00
|
|
|
https://github.com/hybridgroup/gobot/blob/master/platforms/firmata/README.md
|
2014-10-17 12:42:07 -05:00
|
|
|
*/
|
2023-05-20 14:25:21 +02:00
|
|
|
package firmata // import "gobot.io/x/gobot/v2/platforms/firmata"
|