Description
This high quality 4×3 Keypad Matrix lets you quickly add controls to your electronics projects. It offers 0-9 numerals, standard star(*) and hash(#) symbols.
Features:
- 100% brand new and high quality.
- 12 Button Matrix 0-9 # *
- Excellent price-performance ratio Easy communication with any microcontroller
Getting started with the 16 4 x 3 Matrix Array 12 Keys 4*3 Switch Keypad Keyboard Module.
Step1: Hardware required
Step2: Connecting the Hardware
If you want to test your Keypad this resistor is not necessary.
Step3: Upload the Code
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{‘1’, ‘2’, ‘3’},
{‘4’, ‘5’, ‘6’},
{‘7’, ‘8’, ‘9’},
{‘*’, ‘0’, ‘#’}
};
byte rowPins[ROWS] = {8, 7, 6, 5};
byte colPins[COLS] = {4, 3, 2};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
Serial.begin(9600);
}
void loop(){
char customKey = customKeypad.getKey();
if (customKey){
Serial.println(customKey);
}
}
NOTE: If you get stray error the problem is with your “ ” and ‘ characters .Replace them with ordinary quotes “ and’. And you should be fine.