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