how to use below string for one time only and user can not use it again??
if (readString == "1 3 5 9 7 8 4 3 2")
{
digitalWrite (buzzer ,HIGH) ;
delay(500);
digitalWrite(buzzer , LOW) ;
delay(500); }
how to use below string for one time only and user can not use it again??
if (readString == "1 3 5 9 7 8 4 3 2")
{
digitalWrite (buzzer ,HIGH) ;
delay(500);
digitalWrite(buzzer , LOW) ;
delay(500); }
don't post snippets and use code tags....
Just add a "flag" to memorize that you've been through the test (if this is your question)
bool firstTime = true; // global variable
...
// later in code
if (firstTime) {
if (readString == "1 3 5 9 7 8 4 3 2") {
digitalWrite (buzzer ,HIGH) ;
delay(500);
digitalWrite(buzzer , LOW) ;
delay(500);
firstTime = false;
}
}
@OP
Do you want say -- ?
"I shall be using the InputBox of the Serial Monitor of my UNO to send a 'string' towards the MCU of the UNO Board; a buzzer attached with DPin-2 of the UNO will just beep once if the received string matches with this string: 1 3 5 9 7 8 4 3 2. I can't properly figure out the solution strategy of this problem; please, help."