Skip to content

Latest commit

 

History

History
107 lines (59 loc) · 1.91 KB

expander-CD74HC4067_NANO_BACKPACK.md

File metadata and controls

107 lines (59 loc) · 1.91 KB

Expander - CD74HC4067, 16 Channel Analog Input Breakout

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

docs/breadboard/expander-CD74HC4067-14-pots.png

Fritzing diagram: docs/breadboard/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

docs/images/CD74HC4067-3-pot-barcli.png

Learn More

 

License

Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.