Need to control over a thousand servos, LED's or motors with Johnny-Five? We've got you covered.

The team is pleased to introduce everyone to the new Expander class for Johnny-Five. Expanders are used to add more pins to your micro-controller and the expander class brings built in support for several of the most popular ones. Additionally, most expanders are addressable so you can chain anywhere from four to sixty four of them on a single interface.

  • MCP23017 - 16 Channel, 16-bit Port Expander
  • MCP23008 - 8 channel, 8-bit Port Expander
  • PCF8574 - 8 Channel, 8-bit Port Expander
  • CF8574A - 8 Channel, 8-bit Port Expander
  • PCF8575 - 16 Channel, 16-bit Port Expander
  • PCF8591 - 4 Channel, 8-bit Port Expander
  • PCA9685 - 16-channel, 12-bit PWM Expander.

The following breakout boards and shields that depend on these expanders have all been tested with Johnny-Five.

Expanders can be instantiated as virtual boards or device controllers.

Expander as a virtual board

var five = require("johnny-five.js");
var board = new five.Board();

board.on("ready", function() {
  var virtual = new five.Board.Virtual(
    new five.Expander("PCA9685")
  );

  var servo = new five.Servo({
    pin: 1,
    board: virtual
  });

  servo.sweep();
});

Expander as a device controller

var five = require("johnny-five.js");
var board = new five.Board();

board.on("ready", function() {
  var servo = new five.Servo({
    pin: 1,
    controller: "PCA9685"
  });

  servo.sweep();
});

Please report any issues here.




Donovan Buck on November 3rd 2015

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