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
const Barcli = require("barcli");
const { Board, Expander, Sensor } = require("johnny-five");
const board = new Board({
  repl: false,
  debug: false,
});

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

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

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

  inputs.forEach(pin => {

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

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

    // Display all changes in the terminal
    // as a Barcli chart graph
    sensor.on("change", () => {
      bar.update(sensor.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