Greeting tinkers, i need some help from professional to combine my keypad 3x4 membrane password lock coding into my new void loop function.
This is my keypad password coding:
#define Password_Length 8
char Data[Password_Length];
char Master[Password_Length] = "1234567";
byte data_count = 0, master_count = 0;
bool Pass_is_good;
char customKey;
const byte ROWS = 4;
const byte COLS = 3;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte rowPins[ROWS] = {30, 31, 32, 33};
byte colPins[COLS] = {34, 35, 36};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup(){
lcd.begin(16,2);
lcd.backlight();
}
void loop(){
lcd.setCursor(0,0);
lcd.print("Enter Password:");
customKey = customKeypad.getKey();
if (customKey){
Data[data_count] = customKey;
lcd.setCursor(data_count,1);
lcd.print(Data[data_count]);
data_count++;
}
if(data_count == Password_Length-1){
lcd.clear();
if(!strcmp(Data, Master)){
lcd.print("Correct");
delay(5000);
}
else{
lcd.print("Incorrect");
delay(1000);
}
lcd.clear();
clearData();
}
}
void clearData(){
while(data_count !=0){
Data[data_count--] = 0;
}
return;
}
Below is my new void loop that need to combine with my keypad password coding:
void loop()
{
if(digitalRead(up)==0 || digitalRead(down)==0)
{
for(int i=0;i<5;i++)
{
lcd.clear();
lcd.print("Place Finger");
delay(2000);
int result=getFingerprintIDez();
if(result>=0)
{
digitalWrite(openLight, HIGH);
digitalWrite(closeLight, LOW);
lcd.clear();
lcd.print("Verification no.");
lcd.setCursor(0,1);
lcd.print("has been send");
delay(3000);
lcd.clear();
lcd.print("Please check");
lcd.setCursor(0,1);
lcd.print("your mobile");
delay(3000);
open_close_motor();
delay(1000);
}
checkKeys();
delay(2000);
}
}
}
Any help would be appreciate ![]()