hybridgroup.gobot/examples/tello.go

42 lines
647 B
Go
Raw Normal View History

// +build example
//
// Do not build by default.
/*
How to run:
Connect to the drone's Wi-Fi network from your computer. It will be named something like "TELLO-XXXXXX".
Once you are connected you can run the Gobot code on your computer to control the drone.
go run examples/tello.go
*/
package main
import (
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/dji/tello"
)
func main() {
drone := tello.NewDriver("8888")
work := func() {
drone.TakeOff()
gobot.After(5*time.Second, func() {
drone.Land()
})
}
robot := gobot.NewRobot("tello",
[]gobot.Connection{},
[]gobot.Device{drone},
work,
)
robot.Start()
}