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-06-04 18:36:55 +02:00
|
|
|
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
|
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() {
|
2024-02-11 15:34:50 +01:00
|
|
|
if err := led.Toggle(); err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
2014-10-17 12:42:07 -05:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("bot",
|
|
|
|
[]gobot.Connection{firmataAdaptor},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2024-02-11 15:34:50 +01:00
|
|
|
if err := robot.Start(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2014-10-17 12:42:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
For further information refer to firmata readme:
|
2024-02-13 15:58:31 +01:00
|
|
|
https://github.com/hybridgroup/gobot/blob/release/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"
|