Greetings all.
i hav a problim with reading a keypad in a switch / case statement ( the first is working but when i want to use a second one it won't work )
It is a simple YES NO question where an LCD shows the Question and you press de * for Yes or the # for NO
how do i get to the second switch case statement ( it is not working )
And if it is corrected and working, how do i get back to the main loop and go on the run the code further on at the end of the switch case statements
basic senario.
- question to be answerd with YES or NO
2a. When answer is YES execute code after Case # ( from first switch case statement)
2b. When answer is NO execute code after Case* ( from first switch case statement and enter next switch case statement )
3a. When answer to second question is YES execute code after Case # ( from second switch case statement and return to main loop and run code further on beyound switch statements)
3b. When answer to second question is NO execute code after Case * ( from second switch case statement and return to main loop and run code further on beyond switch statements)
i hope someone can help me with this.
i am working on it for quite some time now and don't seem to get it clear.
Void loop();
{
BLA BLA BLA
lcd.print("# = YES / * = NO");
char keyone = customKeypad.getKey();
switch (keyone)
{
case '*':
{
BLA BLA
lcd.print("Next questiont");
lcd.print("# = YES / * = NO");
char subkey = customKeypad.getKey();
switch (subkey)
{
case '*':
{
lcd.print("Next question");
should i use break or return here
}
case '#':
{
lcd.print("Some text for #");
should i use break or return here what does a return do her and what does a break do here
what sould i use to break out of the second switch loop to go back to the main loop ( so out of the first swicht loop too)
}
default:
{
return;
}
}
}
case '#':
{
lcd.print("some text2 ");
break;
}
default:
return;
}
some default code to run further on
}
Greetings Adriaan