I'm attempting to turn on a set of LED's one at a time and then switch them all off at the same time, I am stuck however on turning them off at the same time.
That is my code:
int ledpins[] = {2,3,4,5,6,7,8,9}; //creates a list of the pins in use
void setup() {
for (int i = 0; i < 8; i++){
pinMode(ledpins[i], OUTPUT); // iterates over the list led pins from the 0 pin to the pins before the eigth
}
}
void loop() {
for (int i = 0; i < 8; i++){
digitalWrite(ledpins[i], HIGH); // turns all the pins of one at a time
}
delay(100); //when all on will wait 100 ms
digitalWrite(ledpins[0,7], LOW); //turns off all the leds at once
delay(100);
}
The annotations are for my own understanding. I just need help turning all the LED's off at once which I dont know the command for.