2017-03-13 23:01:39 +08:00
|
|
|
// +build example
|
|
|
|
//
|
|
|
|
// Do not build by default.
|
|
|
|
|
2016-10-19 00:28:22 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/platforms/firmata"
|
2016-10-19 00:28:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// Example of a simple led toggle without the initialization of
|
|
|
|
// the entire gobot framework.
|
|
|
|
// This might be useful if you want to use gobot as another
|
|
|
|
// golang library to interact with sensors and other devices.
|
|
|
|
func main() {
|
|
|
|
f := firmata.NewAdaptor("/dev/ttyACM0")
|
|
|
|
f.Connect()
|
|
|
|
|
|
|
|
led := gpio.NewLedDriver(f, "13")
|
|
|
|
led.Start()
|
|
|
|
|
|
|
|
for {
|
|
|
|
led.Toggle()
|
|
|
|
time.Sleep(1000 * time.Millisecond)
|
|
|
|
}
|
|
|
|
}
|