2013-10-22 16:45:31 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-12-03 00:48:20 -08:00
|
|
|
"github.com/hybridgroup/gobot"
|
2013-12-03 16:11:24 -08:00
|
|
|
"github.com/hybridgroup/gobot-firmata"
|
|
|
|
"github.com/hybridgroup/gobot-gpio"
|
2013-10-22 16:45:31 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
2013-12-03 16:11:24 -08:00
|
|
|
firmata := new(gobotFirmata.FirmataAdaptor)
|
|
|
|
firmata.Name = "firmata"
|
|
|
|
firmata.Port = "/dev/ttyACM0"
|
2013-11-13 20:47:21 -08:00
|
|
|
|
2013-12-03 16:11:24 -08:00
|
|
|
led := gobotGPIO.NewLed(firmata)
|
|
|
|
led.Name = "led"
|
|
|
|
led.Pin = "13"
|
2013-11-13 20:47:21 -08:00
|
|
|
|
|
|
|
work := func() {
|
2013-12-03 16:11:24 -08:00
|
|
|
gobot.Every("1s", func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
2013-11-13 20:47:21 -08:00
|
|
|
}
|
|
|
|
|
2013-12-03 16:11:24 -08:00
|
|
|
robot := gobot.Robot{
|
2013-12-30 13:56:16 -08:00
|
|
|
Connections: []gobot.Connection{firmata},
|
|
|
|
Devices: []gobot.Device{led},
|
2013-11-13 20:47:21 -08:00
|
|
|
Work: work,
|
|
|
|
}
|
|
|
|
|
|
|
|
robot.Start()
|
2013-10-22 16:45:31 -07:00
|
|
|
}
|