If I type 200 , it prints 01234
The 1234 is the password from the Setup. I don't know why it's storing the inputSetupArray in the inputTimeArray.
I'm taking a look at it now.
edit 2: After removing the 'inputTimeArray = '/0';' , it prints 20001234 after typing 20000. edit 3: I found the solution! Adding the following fixed the problem: ```
x = 0; //Reset your entryindex so that it effectively clears your entry.
inputSetupArray[x] = '\0'; //Always add the null* ```
I've created a function when the bomb is disarmed, and the user presses '#', then all arrays reset, and the user gets redirected to the SETUP case.
Now the strange thing is, that when I need to enter the password in the SETUP case, and press one number on the keypad, then the whole inputSetupArray gets printed on the lcd.
It's strange because the arrays is reseted in the FINISHED function.
Here is the code:
This is how I reset the arrays:
char key = keypad.getKey();
if(key == '#') {
x = 0;
inputSetupArray[x] = '\0';
i = 0;
inputTimeArray[i] = '\0';
a = 0;
inputArmArray[a] = '\0';
b = 0;
inputDisarmArray[b] = '\0';
bombState = SETUP;
}
}
Am I resetting it the wrong way or is there something else?