I have this multiple LED circuit, in which the program lights up each LED in sequence and then loops (simple). Now i'd like to add the button to interrupt the circuit, but get the LED (which was lit up when pressing the button) to stay on. Sort of like the arcade game "cyclone".
Here is some code if you are a bit confused on how I did this:
void setup() {
for (int Pin = 3; Pin < 8; Pin++) {
pinMode(Pin, OUTPUT);
}
}
void loop() {
for (int Pin = 3; Pin < 8; Pin++) {
digitalWrite(Pin, HIGH);
delay(100);
digitalWrite(Pin, LOW);
}
for (int Pin = 7; Pin >= 3; Pin--) {
digitalWrite(Pin, HIGH);
delay(100);
digitalWrite(Pin, LOW);
}
}
I also attached a picture of how my wiring is...
Thanks in advance!