gobot.io/x/gobot@v1.16.0/examples/holystone_hs200.go (about)

     1  // +build example
     2  //
     3  // Do not build by default.
     4  
     5  /*
     6   How to run
     7  	go run examples/holystone_hs200.go
     8  
     9  */
    10  
    11  package main
    12  
    13  import (
    14  	"time"
    15  
    16  	"gobot.io/x/gobot"
    17  	"gobot.io/x/gobot/platforms/holystone/hs200"
    18  )
    19  
    20  func main() {
    21  	drone := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080")
    22  
    23  	work := func() {
    24  		drone.TakeOff()
    25  
    26  		gobot.After(5*time.Second, func() {
    27  			drone.Land()
    28  		})
    29  	}
    30  
    31  	robot := gobot.NewRobot("hs200",
    32  		[]gobot.Connection{},
    33  		[]gobot.Device{drone},
    34  		work,
    35  	)
    36  
    37  	robot.Start()
    38  }