Skip to content

Latest commit

 

History

History
87 lines (50 loc) · 1.63 KB

keypad-4X4_I2C_NANO_BACKPACK.md

File metadata and controls

87 lines (50 loc) · 1.63 KB

Keypad - 4x4 I2C Nano Backpack

Breadboard for "Keypad - 4x4 I2C Nano Backpack"

docs/breadboard/keypad-4X4_I2C_NANO_BACKPACK.png

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

 

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.