hybridgroup.gobot/examples/beaglebone_blink_usr_led.go

29 lines
490 B
Go
Raw Normal View History

2014-09-18 06:20:08 +08:00
package main
import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/drivers/gpio"
2014-09-18 06:20:08 +08:00
"github.com/hybridgroup/gobot/platforms/beaglebone"
)
func main() {
beagleboneAdaptor := beaglebone.NewAdaptor()
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,
)
robot.Start()
2014-09-18 06:20:08 +08:00
}