Hello, thanks for taking the time to even read my post with the expectation of offering help!
I am trying to simply light 10 LEDs in sequence from low to high, DONE
I am trying to simply light 10 LEDs in sequence from high to low, DONE
I am trying to change the timing/delay of each afore mentioned events, DONE
I am trying to make any part of this stop after n times (n is the number of times I will choose) FAIL
-also, how do I get more than one LED to light simultaneously?
So, I got the sequencing but cannot get a DO, WHILE, DO WHILE, or FOR to stop the looping, EVER.
I declared an integer [loops] and tried to increment/decrement using loops++, loops--, ++loops, --loops, loops +1, loops - 1, loops = loops -1, loops = loops +1, loops != 1, loops !0 (I read that when the WHILE becomes FALSE is when the event is recognized)
here is the last attempt with some of the bad code commented out
//int thisPin = 0;
int timer = 100; // The higher the number, the slower the timing.
int pinCount = 10; // using 10 LEDs
// int loops = 3; //FAIL
// int thisPin;
void setup() {
// use a for loop to initialize each pin as an output:
for (int thisPin = 1; thisPin < pinCount; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
int loops = 3; //FAIL
while ( loops != 1 ){ //fAIL
// loops - 1;
for (int thisPin = 1; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}
}