#include <Keypad.h>
const byte numRows= 4; //number of rows on the keypad
const byte numCols= 4; //number of columns on the keypad
char keymap[numRows][numCols]=
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[numRows] = {15,16,17,18}; //Rows 0 to 3 //if you modify your pins you should modify this too
byte colPins[numCols]= {19,21,22,23};
Keypad myKeypad=Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
void setup() {
Serial.begin(115200);
Serial.print("Keypad Code");
}
void loop() {
char keypressed = myKeypad.getKey();
if(keypressed){
if(keypressed=='#')
{
Serial.println("\n TripleMI2");
}
else
{
Serial.print(keypressed);
}
}
}
Loading
esp32-devkit-c-v4
esp32-devkit-c-v4