gobot.io/x/gobot@v1.16.0/examples/tinkerboard_blink.go (about) 1 // +build example 2 // 3 // Do not build by default. 4 5 package main 6 7 import ( 8 "time" 9 10 "gobot.io/x/gobot" 11 "gobot.io/x/gobot/drivers/gpio" 12 "gobot.io/x/gobot/platforms/tinkerboard" 13 ) 14 15 func main() { 16 r := tinkerboard.NewAdaptor() 17 led := gpio.NewLedDriver(r, "7") 18 19 work := func() { 20 gobot.Every(1*time.Second, func() { 21 led.Toggle() 22 }) 23 } 24 25 robot := gobot.NewRobot("blinkBot", 26 []gobot.Connection{r}, 27 []gobot.Device{led}, 28 work, 29 ) 30 31 robot.Start() 32 }