Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created January 22, 2014 15:39
Show Gist options
  • Save rwaldron/8560931 to your computer and use it in GitHub Desktop.
Save rwaldron/8560931 to your computer and use it in GitHub Desktop.
var five = require("../lib/johnny-five.js");
var Spark = require("spark-io");
var board = new five.Board({
io: new Spark({
token: "a81cf99a8c1fe45b74d749d521a32671eb443d5e",
deviceId: "53ff6f065067544840551187"
})
});
board.on("ready", function() {
var dir = 0;
var servo = new five.Servo("D0");
setInterval(function() {
var pos = 120;
if (dir ^= 1) {
pos = 60;
}
servo.to(pos);
}, 750);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment