gobot.io/x/gobot@v1.16.0/examples/edison_blink_without_all_gobot_framework.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/drivers/gpio"
    11  	"gobot.io/x/gobot/platforms/intel-iot/edison"
    12  )
    13  
    14  // Example of a simple led toggle without the initialization of
    15  // the entire gobot framework.
    16  // This might be useful if you want to use gobot as another
    17  // golang library to interact with sensors and other devices.
    18  func main() {
    19  	e := edison.NewAdaptor()
    20  	e.Connect()
    21  
    22  	led := gpio.NewLedDriver(e, "13")
    23  	led.Start()
    24  
    25  	for {
    26  		led.Toggle()
    27  		time.Sleep(1000 * time.Millisecond)
    28  	}
    29  }