Okay, here is what I've tried:
(I've leaved the ARMED case as it is)
-First attempt:
Errors:
If the 'Set Time' menu appears and I enter the time I want, then it redirects to the ARMED case when I press 1 number on the keypad.
It needs to have the possibility to enter more then 1 number.
char SetTimeButton[1] = {'*'};
int x = 0; // store the keypresses here
case SETTIME: // set the countdown time
{
char TimeCode[4];
lcd.setCursor(0,0);
lcd.print("Enter Time");
char key = keypad.getKey();
//if a key is pressed
if(key)
{
TimeCode[x] = key;
x++;
x = setTime;
lcd.setCursor(0,1); // set cursor at column 0 and row 1
lcd.print(setTime); // print keypad character entry to lcd
if(key)
{
if(SetTimeButton[0]) {
lcd.clear();
bombState = ON;
}
}
}
}
break;
-Second attempt:
Errors: - I can enter the time with 4 numbers this time, but I can't enter a time value with less then 4 numbers.
- If the 4 numbers are entered, then the countdown won't start >> just an empty screen.
char TimeCode[4];
int x = 0; // store the keypresses here
if(key)
{
TimeCode[x] = key;
x++;
lcd.setCursor(0,1); // set cursor at column 0 and row 1
lcd.print(key); // print keypad character entry to lcd
if (x == 4) // if 4 presses on the keypad have been made
{
x = setTime;
lcd.clear();
bombState = ON;
}
}
}
break;
How should I create an array that doesn't have a minium of keys to be entered?