Arduino matrix keypad tutorial:
In this article, we know about the Arduino matrix keypad . this matrix keypad available on different type They are 3x3 and 4x4 types . now we learn about 4x4 matrix keypad . this 4x4 matrix keypad has a total of 16 keys . And it has 8 pins ,these 8 pins are divided into 4row pins and 4 column pins .know more details about this matrix keypad watch below video.
Components :
If you want to buy Arduino components, I am giving my affiliate links. If you buy the components using my affiliate links, it will help to our channel and website growth. so do these small help.
Arduino matrix keypad program :
// Include the Keypad library
#include <Keypad.h>
// Constants for row and column sizes
const byte ROWS = 4;
const byte COLS = 4;
// Array to represent keys on keypad
char mekeypad[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
// Connections to Arduino
byte rowPins[ROWS] = {9, 8, 7, 6};
byte colPins[COLS] = {5, 4, 3, 2};
// Create keypad object
Keypad customKeypad = Keypad(makeKeymap(mekeypad), rowPins, colPins, ROWS, COLS);
void setup() {
// Setup serial monitor
Serial.begin(9600);
}
void loop() {
// Get key value if pressed
char customKey = customKeypad.getKey();
if (customKey) {
// Print key value to serial monitor
Serial.println(customKey);
}
}
if you have any doubts regarding to this project, contact me on Instagram or comment on YouTube video. I will help my best.
0 Comments