Skip to content

Instantly share code, notes, and snippets.

@miaoski
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miaoski/faa05941ae496504ef41 to your computer and use it in GitHub Desktop.
Save miaoski/faa05941ae496504ef41 to your computer and use it in GitHub Desktop.
Drone lib test
Drone = require './drone'
white = \44c2ecadf8b443d08ba485612189bb6e
blue = \37103d1e4f024913a2777f3f015037eb
red = \1447dcb43e48451b8bbd1647fa28554a
up = !-> it.up {steps: 30}
forward = !-> it.forward {steps: 300}
turnLeft = !-> it.turnLeft {steps: 300}
tiltLeft = !-> it.tiltLeft {steps: 30, speed: 100}
tiltRight = !-> it.tiltRight {steps: 30, speed: 100}
frontFlip = !-> it.frontFlip!
land = !-> it.land!
w = new Drone(white)
w.connect! !->
w.setup! !->
w.startPing!
w.flatTrim!
w.takeOff!
<-! setTimeout _, 2000ms; up w
<-! setTimeout _, 3000ms; forward w
<-! setTimeout _, 5000ms; turnLeft w
<-! setTimeout _, 3000ms; forward w
<-! setTimeout _, 5000ms; tiltLeft w
<-! setTimeout _, 2000ms; tiltRight w
<-! setTimeout _, 2000ms; frontFlip w
<-! setTimeout _, 2000ms; land w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment