Breadboard for "LCD - I2C PCF8574"

lcd-i2c-PCF8574.png

 

Run this example from the command line with:

node eg/lcd-i2c-PCF8574.js
var five = require("johnny-five");
var board = new five.Board();

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


  var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase();

  // Controller: PARALLEL (default)
  var p = new five.LCD({
    pins: [8, 9, 4, 5, 6, 7],
    backlight: 10,
  });

  p.useChar("heart");
  p.cursor(0, 0).print("hello :heart:");
  p.blink();
  p.cursor(1, 0).print("Blinking? ");
  p.cursor(0, 10).print(random);


  // Controller: JHD1313M1 (Grove)
  var j = new five.LCD({
    controller: "JHD1313M1"
  });

  j.useChar("heart");
  j.cursor(0, 0).print("hello :heart:");
  j.blink();
  j.cursor(1, 0).print("Blinking? ");
  j.cursor(0, 10).print(random);


  // Controller: PCF8574A (Generic I2C)
  // Locate the controller chip model number on the chip itself.
  var l = new five.LCD({
    controller: "PCF8574A"
  });

  l.useChar("heart");
  l.cursor(0, 0).print("hello :heart:");
  l.blink();
  l.cursor(1, 0).print("Blinking? ");
  l.cursor(0, 10).print(random);


  setTimeout(function() {
    process.exit(0);
  }, 3000);
});

 

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