2014-09-18 06:20:08 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
2016-10-03 22:58:43 +08:00
|
|
|
"github.com/hybridgroup/gobot/drivers/gpio"
|
2014-09-18 06:20:08 +08:00
|
|
|
"github.com/hybridgroup/gobot/platforms/beaglebone"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-03 22:58:43 +08:00
|
|
|
beagleboneAdaptor := beaglebone.NewAdaptor()
|
2016-12-03 20:17:31 +08:00
|
|
|
led := gpio.NewLedDriver(beagleboneAdaptor, "usr1")
|
2014-09-18 06:20:08 +08:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
|
|
[]gobot.Connection{beagleboneAdaptor},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:08:25 +08:00
|
|
|
robot.Start()
|
2014-09-18 06:20:08 +08:00
|
|
|
}
|