Breadboard for "Stepper - Driver"


Fritzing diagram: stepper-driver.fzz


Run this example from the command line with:

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

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

   * In order to use the Stepper class, your board must be flashed with
   * either of the following:
   * - AdvancedFirmata
   * - ConfigurableFirmata

  var stepper = new five.Stepper({
    type: five.Stepper.TYPE.DRIVER,
    stepsPerRev: 200,
    pins: {
      step: 12,
      dir: 11

  // Make 10 full revolutions counter-clockwise at 180 rpm with acceleration and deceleration
  stepper.rpm(180).ccw().accel(1600).decel(1600).step(2000, function() {

    console.log("Done moving CCW");

    // once first movement is done, make 10 revolutions clockwise at previously
    //      defined speed, accel, and decel by passing an object into stepper.step
      steps: 2000,
      direction: five.Stepper.DIRECTION.CW
    }, function() {
      console.log("Done moving CW");

Additional Notes


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