Hi folks.
Just wondering how I integrate i into a variable name:
for(int i = 1, i <= 10, i++) {
digitalWrite(l + i, LOW);
delay(d);
}
I'm sick of running through pin numbers LOL.
Cheers
Hi folks.
Just wondering how I integrate i into a variable name:
for(int i = 1, i <= 10, i++) {
digitalWrite(l + i, LOW);
delay(d);
}
I'm sick of running through pin numbers LOL.
Cheers
Put the pin numbers in an array. Reference the array in the for loop:
const byte myLEDpins[] = {8, 4, 2, 9, 11, 12};
void loop()
{
for(byte i=0; i<6; i++)
{
digitalWrite(myLEDpins[i], HIGH);
}
}