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

     1  // +build example
     2  //
     3  // Do not build by default.
     4  
     5  /*
     6  How to run:
     7  Connect to the drone's Wi-Fi network from your computer. It will be named something like "TELLO-XXXXXX".
     8  
     9  Once you are connected you can run the Gobot code on your computer to control the drone.
    10  
    11  	go run examples/tello.go
    12  */
    13  
    14  package main
    15  
    16  import (
    17  	"time"
    18  
    19  	"gobot.io/x/gobot"
    20  	"gobot.io/x/gobot/platforms/dji/tello"
    21  )
    22  
    23  func main() {
    24  	drone := tello.NewDriver("8888")
    25  
    26  	work := func() {
    27  		drone.TakeOff()
    28  
    29  		gobot.After(5*time.Second, func() {
    30  			drone.Land()
    31  		})
    32  	}
    33  
    34  	robot := gobot.NewRobot("tello",
    35  		[]gobot.Connection{},
    36  		[]gobot.Device{drone},
    37  		work,
    38  	)
    39  
    40  	robot.Start()
    41  }