1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-26 13:48:49 +08:00

43 lines
886 B
Go
Raw Normal View History

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:
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
Example:
2014-10-17 12:42:07 -05:00
package main
import (
"time"
"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() {
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,
)
robot.Start()
2014-10-17 12:42:07 -05:00
}
For further information refer to firmata readme:
https://github.com/hybridgroup/gobot/blob/master/platforms/firmata/README.md
2014-10-17 12:42:07 -05:00
*/
package firmata // import "gobot.io/x/gobot/v2/platforms/firmata"