hybridgroup.gobot/examples/ardrone.go

31 lines
484 B
Go
Raw Normal View History

package main
import (
2014-07-11 08:21:21 +08:00
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/parrot/ardrone"
)
func main() {
ardroneAdaptor := ardrone.NewAdaptor()
drone := ardrone.NewDriver(ardroneAdaptor)
work := func() {
drone.On(ardrone.Flying, func(data interface{}) {
gobot.After(3*time.Second, func() {
drone.Land()
})
})
drone.TakeOff()
}
2014-07-09 09:36:14 +08:00
robot := gobot.NewRobot("drone",
[]gobot.Connection{ardroneAdaptor},
[]gobot.Device{drone},
work,
)
robot.Start()
}