Breadboard for "Keypad - 4x4 I2C Nano Backpack"

keypad-4X4_I2C_NANO_BACKPACK.png

Fritzing diagram: keypad-4X4_I2C_NANO_BACKPACK.fzz

 

Run this example from the command line with:

node eg/keypad-4X4_I2C_NANO_BACKPACK.js
var five = require("johnny-five");
var board = new five.Board();

board.on("ready", function() {
  
  // 4X4_I2C_NANO_BACKPACK Example
  var keypad = new five.Keypad({
    controller: "4X4_I2C_NANO_BACKPACK",
    /**
     * 
     * Default keys are set as:
     * [1, 2, 3, 'A', 4, 5, 6, 'B', 7, 8, 9, 'C', "*", 0, "#", 'D']
     * However, the Array can also be multi-dimensional and have a different
     * set of characters than the default.
     * 
     */
    keys: [
      ["!", "@", "#", "?"],
      ["$", "%", "^", "≠"],
      ["&", "-", "+", ";"],
      ["_", "=", ":", "¢"]
    ]
  });

  ["change", "press", "hold", "release"].forEach(function(eventType) {
    keypad.on(eventType, function(event) {
      console.log("Event: %s, Target: %s", eventType, event.which);
    });
  });
});

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