Run this example from the command line with:
node eg/claw.js
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var claw = new five.Servo(9);
var arm = five.Servo(10);
var degrees = 10;
var incrementer = 10;
var last;
this.loop(25, function() {
if (degrees >= 180 || degrees === 0) {
incrementer *= -1;
}
degrees += incrementer;
if (degrees === 180) {
if (!last || last === 90) {
last = 180;
} else {
last = 90;
}
arm.to(last);
}
claw.to(degrees);
});
});
Additional Notes