2016-08-26 00:10:52 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/hybridgroup/gobot"
|
2016-10-03 22:58:43 +08:00
|
|
|
"github.com/hybridgroup/gobot/drivers/gpio"
|
2016-08-26 00:10:52 +08:00
|
|
|
"github.com/hybridgroup/gobot/platforms/intel-iot/joule"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-10-16 02:02:54 +08:00
|
|
|
gbot := gobot.NewMaster()
|
2016-08-26 00:10:52 +08:00
|
|
|
|
2016-10-03 22:58:43 +08:00
|
|
|
e := joule.NewAdaptor()
|
|
|
|
led := gpio.NewLedDriver(e, "100")
|
2016-08-26 00:10:52 +08:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|