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