mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-11 19:29:20 +08:00
26 lines
469 B
Plaintext
26 lines
469 B
Plaintext
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gobot.io/x/gobot/platforms/holystone/hs200"
|
|
"log"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
drone, err := hs200.NewDriver("172.16.10.1:8888", "172.16.10.1:8080")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
drone.Enable()
|
|
drone.TakeOff()
|
|
time.Sleep(5 * time.Second)
|
|
for lift := 256; lift >= 0; lift -= 16 {
|
|
fmt.Printf("Lift is %d\n", lift)
|
|
drone.VerticalControl(lift)
|
|
time.Sleep(250*time.Millisecond)
|
|
}
|
|
drone.Land()
|
|
time.Sleep(10 * time.Second)
|
|
}
|