1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-14 19:29:32 +08:00

50 lines
963 B
Markdown
Raw Normal View History

2014-06-09 19:01:53 -07:00
# Ardrone
2014-06-09 19:01:53 -07:00
This package provides the Gobot adaptor and driver for the [Parrot Ardrone](http://ardrone2.parrot.com).
For more information about Gobot, check out the github repo at
https://github.com/hybridgroup/gobot
2014-06-09 19:01:53 -07:00
## Getting Started
## Installing
```
2014-07-06 14:17:10 -05:00
go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/ardrone
```
## Using
```go
package main
import (
2014-07-10 17:02:00 -07:00
"time"
"github.com/hybridgroup/gobot"
2014-06-09 19:01:53 -07:00
"github.com/hybridgroup/gobot/platforms/ardrone"
)
func main() {
2014-06-09 19:01:53 -07:00
gbot := gobot.NewGobot()
2014-07-10 17:02:00 -07:00
ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone")
drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone")
work := func() {
drone.TakeOff()
2014-07-10 17:02:00 -07:00
gobot.On(drone.Event("flying"), func(data interface{}) {
2014-06-09 19:01:53 -07:00
gobot.After(3*time.Second, func() {
drone.Land()
})
})
}
2014-07-10 17:02:00 -07:00
robot := gobot.NewRobot("drone",
[]gobot.Connection{ardroneAdaptor},
[]gobot.Device{drone},
work,
)
gbot.AddRobot(robot)
2014-06-09 19:01:53 -07:00
gbot.Start()
}
2014-07-10 17:02:00 -07:00
```