#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
const int R = 4;
const int C = 4;
char keys[R][C] = {
{ '1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowpins [R] = {9,8,7,6};
byte colpins [C] = {5,4,3,2};
LiquidCrystal_I2C lcd(0x27,16,2);
Keypad myKeypad = Keypad(makeKeymap(keys),rowpins,colpins,R,C);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Enter password:");
lcd.setCursor(0,1);
}
void loop() {
// put your main code here, to run repeatedly:
char Input = myKeypad.getKey();
char password [] = {1,2,3,4};
char typein [4] = {1,1,1,1};
int i = 0;
int res = strcmp (typein,password);
if (Input){
lcd.print(Input);
typein [i] = Input;
Serial.print(typein[i]);
i++;
if (res == 0){
Serial.print("pass");
}
}
}