Needed to setup the event handler before the method that triggers it
This commit is contained in:
parent
59dbd6d15c
commit
fdf5576e15
|
@ -14,13 +14,14 @@ func main() {
|
||||||
drone := bebop.NewBebopDriver(bebopAdaptor, "Drone")
|
drone := bebop.NewBebopDriver(bebopAdaptor, "Drone")
|
||||||
|
|
||||||
work := func() {
|
work := func() {
|
||||||
drone.HullProtection(true)
|
|
||||||
drone.TakeOff()
|
|
||||||
gobot.On(drone.Event("flying"), func(data interface{}) {
|
gobot.On(drone.Event("flying"), func(data interface{}) {
|
||||||
gobot.After(3*time.Second, func() {
|
gobot.After(3*time.Second, func() {
|
||||||
drone.Land()
|
drone.Land()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
drone.HullProtection(true)
|
||||||
|
drone.TakeOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
robot := gobot.NewRobot("drone",
|
robot := gobot.NewRobot("drone",
|
||||||
|
|
Loading…
Reference in New Issue