Hi all, this is a basic programming question.
I have a set up where a button changes a button state. (ranging from 0-5)
What i want to do is:
Make some leds flash a few times when a button state is reached.
Then Stop these flashing leds and continue with the rest of the program.
I am looking at 'for' statements.
for example:
if (buttonMode == 3) {
for(int i = 0; i<5; i++){
Serial.println(i);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
delay(400);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
delay(400);
}}}}
I am having trouble stopping the code listed above, and I require to play another bit of code after it have been repeated a few times.
I have tried inserting [if button state > 3, 'break:'] etc.
Basically I am missing some fundamental programming knowledge!
Many thanks,