mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-27 13:48:56 +08:00
Add example for Edison blink demo without gobot initialization.
This example shows how to use gobot as another golang library. Signed-off-by: Erich Cordoba <erich.cm@yandex.com>
This commit is contained in:
parent
64d520c756
commit
3b6bf4da74
22
examples/edison_blink_without_all_gobot_framework.go
Normal file
22
examples/edison_blink_without_all_gobot_framework.go
Normal file
@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/hybridgroup/gobot/platforms/gpio"
|
||||
"github.com/hybridgroup/gobot/platforms/intel-iot/edison"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 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() {
|
||||
e := edison.NewEdisonAdaptor("edison")
|
||||
led := gpio.NewLedDriver(e, "led", "13")
|
||||
e.Connect()
|
||||
led.Start()
|
||||
for {
|
||||
led.Toggle()
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user