Chris--A / Keypad

A version of the keypad library found in Wiring. This is just a copy made compatible with the Arduino IDE library manager.
GNU General Public License v3.0
252 stars 153 forks source link

Example for 4x4 keypad (0~9 + A, B, C, D) #27

Closed rtek1000 closed 5 years ago

rtek1000 commented 5 years ago

If someone needs to use a 4x4 keypad of this model of the image, can try with this configuration:

keypad 4x4

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad
rtek1000 commented 5 years ago

To avoid use of jumpers (Arduino Nano/Pro Mini):

/*
 * Arduino pins - keypad pins
 * 2- keypad 1 face a (green wires)
 * 3- keypad 2 face a
 * 4- keypad 3 face a
 * 5- keypad 4 face a
 * 6- keypad 5 face b (yellow wires)
 * 7- keypad 6 face b
 * 8- keypad 7 face b
 * 9- keypad 8 face b
 */
byte rowPins[ROWS] = {2, 3, 4, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6, 7, 8, 9}; //connect to the column pinouts of the keypad