-
-
Save deathbearbrown/8579545 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var five = require("johnny-five"); | |
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
I editied the require just to require all of johnny-five.
Directions:
have node installed: http://nodejs.org/download/ Or you can install it via homebrew
copy the above into a folder, name it spark-io-wave.js
In terminal, cd into that folder and run:
npm install spark-io
npm install johnny-five
Now make that robot dance by running:
node spark-io-wave.js