2014-09-19 03:45:54 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
2016-10-03 22:58:43 +08:00
|
|
|
"github.com/hybridgroup/gobot/drivers/gpio"
|
2014-09-19 03:45:54 +08:00
|
|
|
"github.com/hybridgroup/gobot/platforms/intel-iot/edison"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-03 22:58:43 +08:00
|
|
|
e := edison.NewAdaptor()
|
|
|
|
led := gpio.NewLedDriver(e, "13")
|
2014-09-19 03:45:54 +08:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
gobot.Every(1*time.Second, func() {
|
|
|
|
led.Toggle()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("blinkBot",
|
|
|
|
[]gobot.Connection{e},
|
|
|
|
[]gobot.Device{led},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:08:25 +08:00
|
|
|
robot.Start()
|
2014-09-19 03:45:54 +08:00
|
|
|
}
|