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