#include<Keypad.h>
#include<Password.h>
const byte satir = 4;
const byte sutun = 4;
int counter = 0;
Password password = Password ("2024")
char tusTakimi[satir] [sutun] = {'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
byte satirPin[satir] = {9,8,7,6};
byte sutunPin[sutun] = {13,12,11,10};
Keypad pad = Keypad (makeKeypad(tusTakimi),satirPin,sutunPin,satir,sutun);
void setup() {
Serial.begin(9600);
Serial.println("sifrenizi giriniz...");
pad.addEventListener(keypadEvent );
}
void loop() {
pad.getKey();
}
void (KeypadEvent eKey) {
switch (pad.getState)
case PRESSED:
if(eKey=='#') {
Serial.print(counter+2);
Serial.println(". kez şifrenizi giriyorsunuz...");
}
else{
Serial.print(eKey);
}
switch(eKey)
case '*':
checkPassword();
break;
case'#':
password.reset();
break;
default:
password.append(eKey)
break;
}
}
}
}
}