Using an PCF8574 Expander as a Virtual Board (WaveShare 8 Pin Digital IO)
Breadboard for "Expander - PCF8574"
Fritzing diagram: expander-PCF8574.fzz
Run this example from the command line with:
node eg/expander-PCF8574.js
const { Board, Expander, Leds } = require("johnny-five");
const board = new Board();
board.on("ready", () => {
const virtual = new Board.Virtual(
new Expander("PCF8574")
);
const leds = new Leds(
Array.from(Array(8), (_, pin) =>
({ pin, board: virtual })
)
);
leds.blink(500);
board.repl.inject({
leds
});
});