gobot.io/x/gobot@v1.16.0/examples/chip_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/chip" 13 ) 14 15 func main() { 16 chipAdaptor := chip.NewAdaptor() 17 led := gpio.NewLedDriver(chipAdaptor, "XIO-P6") 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{chipAdaptor}, 27 []gobot.Device{led}, 28 work, 29 ) 30 31 robot.Start() 32 }