I am using the phi_interfaces library to read a group of keys.
void loop() {
valid_Key = MyKey.getKey ();
....
.....
......
if ( valid_Key == 'S' && key_Latch) {
key_Latch = 0;
set_RTC_gate = 1;
}
if (set_RTC_gate) set_TimeOfRTC();
delay(100);
}
//=====================
void set_TimeOfRTC() {
lcd.clear();
lcd.print("Entering clock setting!"):
delay(2000);
if ( valid_Key == 'S' ) lcd.print( "Incrementing year");
(rest of code)
}
Now my problem is as soon as I press "S" key, the code enters the set_TimeOfRTC() function and also prints out the "Incrementing year" message after the "Entering clock setting" message + 2 sec delay..
I don't want this to happen like this . The "Incrementing year" message has to happen only on the second press of "S"
In other words after reading the first instance of "S", I need to flush it out prior to entering the next function ... any ideas ?