hybridgroup.gobot/examples/joule_blink.go

33 lines
511 B
Go
Raw Normal View History

package main
import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/gpio"
"github.com/hybridgroup/gobot/platforms/intel-iot/joule"
)
func main() {
gbot := gobot.NewGobot()
e := joule.NewJouleAdaptor("joule")
led := gpio.NewLedDriver(e, "led", "100")
work := func() {
gobot.Every(1*time.Second, func() {
led.Toggle()
})
}
robot := gobot.NewRobot("blinkBot",
[]gobot.Connection{e},
[]gobot.Device{led},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}