#include <LiquidCrystal.h>
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
const int rs = 23, en = 25, d4 = 27, d5 = 29, d6 = 31, d7 = 33;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {35, 37, 39, 41}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {43, 45, 47, 49}; //connect to the column pinouts of the keypad
//Create an object of keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
long Num1,Num2,Number;
char key,action;
boolean result = false;
void setup() {
// put your setup code here, to run once:
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Clears the LCD screen
lcd.clear();
Serial.begin(9600);
}
void loop() {
key = kpd.getKey(); //storing pressed key value in a char
if (key!=NO_KEY)
{lcd.setCursor(0,0); lcd.print(key);}
}