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
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
Learn More