Servo connected to pin 10. Requires servo on pin that supports PWM (usually denoted by ~).
Fritzing diagram: docs/breadboard/servo.fzz
Run this example from the command line with:
node eg/servo-prompt.js
var five = require("johnny-five");
var readline = require("readline");
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
five.Board().on("ready", function() {
var servo = new five.Servo(10);
rl.setPrompt("SERVO TEST (0-180)> ");
rl.prompt();
rl.on("line", function(line) {
servo.to(+line.trim());
rl.prompt();
}).on("close", function() {
process.exit(0);
});
});
Copyright (c) 2012, 2013, 2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2017 The Johnny-Five Contributors Licensed under the MIT license.