Fine with me
- but where to call it? i need this to be cut out in cardboard please (don't know if you can use that saying on English)
In the default case, after you've added the 6th character to the array.
default:
if(z <= 5)
{
attempt[z]=key;
}
z++;
if(z == 5)
{
checkPin();
}
(Takes care of tuxduino's question, too.)
If i use your "if test" how hard would i be to implement for a beginner?
Depends on how willing you are to try. You need a variable to keep track of whether the door is locked, or not. Since the values are true (it is locked) or false (it is not locked), a boolean is ideal.
bool locked = true;
In the default case, add some code:
default:
if(locked)
{
// move all the current code here
}
else
{
// Lock the door, and set locked to true
}
Where you unlock the door, you also need to set locked to false.