1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-04 22:17:39 +08:00

39 lines
538 B
Go
Raw Normal View History

2013-10-22 16:45:31 -07:00
package main
import (
. "gobot"
"time"
)
func main() {
2013-10-24 22:04:58 -07:00
beaglebone := new(Beaglebone)
beaglebone.Name = "Beaglebone"
led := NewLed(beaglebone)
led.Driver = Driver{
Name: "led",
Pin: "P9_12",
2013-10-22 16:45:31 -07:00
}
2013-10-24 22:04:58 -07:00
connections := []interface{} {
beaglebone,
}
devices := []interface{} {
led,
2013-10-22 16:45:31 -07:00
}
work := func(){
2013-10-24 22:04:58 -07:00
Every(1000 * time.Millisecond, func(){ led.Toggle() })
2013-10-22 16:45:31 -07:00
}
robot := Robot{
Connections: connections,
Devices: devices,
Work: work,
}
2013-10-24 22:04:58 -07:00
beaglebone.Connect()
2013-10-22 16:45:31 -07:00
robot.Start()
}