hybridgroup.gobot/examples/beaglebone_blink.go

26 lines
565 B
Go

package main
import (
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/beaglebone"
"github.com/hybridgroup/gobot/platforms/gpio"
"time"
)
func main() {
gbot := gobot.NewGobot()
beagleboneAdaptor := beaglebone.NewBeagleboneAdaptor("beaglebone")
led := gpio.NewLedDriver(beagleboneAdaptor, "led", "P9_12")
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
gbot.Robots = append(gbot.Robots,
gobot.NewRobot("blinkBot", []gobot.Connection{beagleboneAdaptor}, []gobot.Device{led}, work))
gbot.Start()
}