Skip to content

Instantly share code, notes, and snippets.

@finnp
Created September 23, 2015 12:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finnp/33041361d4698e8ea5b2 to your computer and use it in GitHub Desktop.
Save finnp/33041361d4698e8ea5b2 to your computer and use it in GitHub Desktop.
var five = require('johnny-five')
var board = new five.Board()
board.on('ready', function () {
var led = five.Led(13)
var body = new five.Servo(9)
var head = new five.Servo(10)
var laser = five.Led(7)
led.on()
function wiggle (servo, time) {
board.wait(time, function () {
servo.to(0)
board.wait(time, function () {
servo.to(10)
wiggle(servo, time)
})
})
}
this.repl.inject({
led: led,
body: body,
head: head,
laser: laser,
wiggle: wiggle
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment