I can't seem to be able to escape a while loop using a keypad button. I've tried the solution from this thread: https://forum.arduino.cc/index.php?topic=79932.0
Here's my code:
void alarm(){
char customKey = customKeypad.getKey();
while (customKey == NO_KEY){
customKey = customKeypad.getKey();
lcd.noDisplay();
delay(750);// change for faster flash
lcd.display();
delay(750);// change for faster flash
}
lcd_home_screen();
}
I tried both == and != for the while (customKey == NO_KEY)
Additional info: I am calling this alarm function from another function inside my Loop. Here's the complete code:
void loop() {
// keypad
char customKey = customKeypad.getKey();
if (customKey == 'A'){
main_program(5);
}
}
int main_program(int duration){
timer(duration);
alarm();
}