I guys!
I wrote this piece of code but I'm not sure if it work fine. I cannot test it because I don't have the Arduino yet.
My doubt is about the while condition, if I hold on the button "*" the function getState() will be "PRESSED" or after some time it will change in "HOLD" ?
Another question, if I push the button 1 and while I hold the button 1 I push the button 2, the getKey function will be 1 or 2 ?
void active(){
Serial.print(" * has been pressed");
flash(ledPin,100); //flash a led for 0.1 sec.
unsigned long pressTime=millis();
while(keypad.getState()==PRESSED){
if ((millis()-pressTime)>activationTime){
Serial.println("The button * has been pressed for more than 2 sec");
flash(ledPin,1000);
allarmActive=true;
pressTime=millis(); //so, out of the if condition
}
}
}