gobot.io/x/gobot/v2@v2.1.0/examples/edison_blink_without_all_gobot_framework.go (about)

     1  //go:build example
     2  // +build example
     3  
     4  //
     5  // Do not build by default.
     6  
     7  package main
     8  
     9  import (
    10  	"time"
    11  
    12  	"gobot.io/x/gobot/v2/drivers/gpio"
    13  	"gobot.io/x/gobot/v2/platforms/intel-iot/edison"
    14  )
    15  
    16  // Example of a simple led toggle without the initialization of
    17  // the entire gobot framework.
    18  // This might be useful if you want to use gobot as another
    19  // golang library to interact with sensors and other devices.
    20  func main() {
    21  	e := edison.NewAdaptor()
    22  	e.Connect()
    23  
    24  	led := gpio.NewLedDriver(e, "13")
    25  	led.Start()
    26  
    27  	for {
    28  		led.Toggle()
    29  		time.Sleep(1000 * time.Millisecond)
    30  	}
    31  }