Servo on pin 10

Servo connected to pin 10. Requires servo on pin that supports PWM (usually denoted by ~).


Fritzing diagram: servo.fzz


Run this example from the command line with:

node eg/servo-animation.js
var five = require("johnny-five");
var board = new five.Board();

board.on("ready", function() {

  // Create a new `servo` hardware instance.
  var servo = new five.Servo(10);

  // Create a new `animation` instance.
  var animation = new five.Animation(servo);

  // Enqueue an animation segment with options param
  // See Animation example and docs for details
    cuePoints: [0, 0.25, 0.75, 1],
    keyFrames: [90, { value: 180, easing: "inQuad" }, { value: 0, easing: "outQuad" }, 90],
    duration: 2000

  // Inject the `servo` hardware into
  // the Repl instance's context;
  // allows direct command line access
    servo: servo,
    animation: animation


Component Classes in this example:

Hi! The Johnny-Five community is building new projects every day. We made this newsletter to tell you about what's new, what's good, and what's next for Open Source robotics. Join us in exploring what we can make together.

Fork me on GitHub