Using a CD74HC4067 connected to an Arduino Nano Backpack. Displays value of potentiometers in console graph. (npm install barcli)

Using 14 potentiometers!

The CD74HC4067 can accomodate up to 16 inputs

expander-CD74HC4067-14-pots.png

Fritzing diagram: expander-CD74HC4067-14-pots.fzz

 

Run this example from the command line with:

node eg/expander-CD74HC4067_NANO_BACKPACK.js
var Barcli = require("barcli");
var five = require("johnny-five");
var board = new five.Board({
  repl: false,
  debug: false,
});

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

  // Use an Expander instance to create
  // a virtual Board.
  var virtual = new five.Board.Virtual(
    new five.Expander("CD74HC4067")
  );

  var inputs = ["A0", "A7", "A15"];

  inputs.forEach(function(input) {

    var bar = new Barcli({ label: input, range: [0, 1023] });

    // Initialize a Sensor instance with
    // the virtual board created above
    var sensor = new five.Sensor({
      pin: input,
      board: virtual
    });

    // Display all changes in the terminal
    // as a Barcli chart graph
    sensor.on("change", function() {
      bar.update(this.value);
    });
  });
});

Illustrations / Photos

Barcli output

CD74HC4067-3-pot-barcli.png

Learn More

 

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