|
|
Keypad Library
Keypad, written by Mark Stanley and Alexander Brevig,
allows you to connect a Keypad with row-column matrix wiring.
Download: Keypad.zip (version 1.8)
Hardware Requirements
The keypad's signals may connect to any digital pins, but avoid
using the one with a LED attached.
Example Use
This example can be opened from the menu:
File > Examples > Keypad > HelloKeypad
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'#','0','*'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
}
void loop(){
char key = keypad.getKey();
if (key != NO_KEY){
Serial.println(key);
}
}
In this screenshot, each key was pressed once.

Each key pressed once.
|

Bottom side wiring, 7 signals between keypad and Teensy
|
Arduino Playground Page/
has more details to use Keypad.
|