gobot.io/x/gobot@v1.16.0/platforms/parrot/bebop/client/examples/takeoff.go (about) 1 // +build example 2 // 3 // Do not build by default. 4 5 package main 6 7 import ( 8 "fmt" 9 "time" 10 11 "gobot.io/x/gobot/platforms/parrot/bebop/client" 12 ) 13 14 func main() { 15 bebop := client.New() 16 17 if err := bebop.Connect(); err != nil { 18 fmt.Println(err) 19 return 20 } 21 22 bebop.HullProtection(true) 23 24 fmt.Println("takeoff") 25 if err := bebop.TakeOff(); err != nil { 26 fmt.Println(err) 27 fmt.Println("fail") 28 return 29 } 30 time.Sleep(5 * time.Second) 31 fmt.Println("land") 32 if err := bebop.Land(); err != nil { 33 fmt.Println(err) 34 return 35 } 36 37 time.Sleep(5 * time.Second) 38 fmt.Println("done") 39 }