2023-05-20 20:25:21 +08:00
|
|
|
//go:build example
|
2017-03-13 23:01:39 +08:00
|
|
|
// +build example
|
2023-05-20 20:25:21 +08:00
|
|
|
|
2017-03-13 23:01:39 +08:00
|
|
|
//
|
|
|
|
// Do not build by default.
|
|
|
|
|
2016-08-24 10:54:12 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2016-10-03 22:58:43 +08:00
|
|
|
|
2023-05-20 20:25:21 +08:00
|
|
|
"gobot.io/x/gobot/v2/drivers/gpio"
|
|
|
|
"gobot.io/x/gobot/v2/platforms/intel-iot/edison"
|
2016-08-24 10:54:12 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
// Example of a simple led toggle without the initialization of
|
|
|
|
// the entire gobot framework.
|
|
|
|
// This might be useful if you want to use gobot as another
|
|
|
|
// golang library to interact with sensors and other devices.
|
|
|
|
func main() {
|
2016-10-03 22:58:43 +08:00
|
|
|
e := edison.NewAdaptor()
|
2016-08-24 10:54:12 +08:00
|
|
|
e.Connect()
|
2016-10-19 03:08:25 +08:00
|
|
|
|
|
|
|
led := gpio.NewLedDriver(e, "13")
|
2016-08-24 10:54:12 +08:00
|
|
|
led.Start()
|
2016-10-19 03:08:25 +08:00
|
|
|
|
2016-08-24 10:54:12 +08:00
|
|
|
for {
|
|
|
|
led.Toggle()
|
|
|
|
time.Sleep(1000 * time.Millisecond)
|
|
|
|
}
|
|
|
|
}
|