Hello There,
I am trying to program my arduino uno
with a serie of 6 red leds on output 2-7 to
sequintially go on/off in one direction (this I got)
and in the reverse direction the even LEDs blink twice and
the uneven LEDS blink once. (in my model all the leds blink twice and I cant find the command to skip the odd numbers)
this is what I have:
int timer = 300; // The higher the number, the slower the timing.
void setup()
{ // use a for loop to initialize each pin as an output:
for (int thisPin = 2; thisPin < 8; thisPin++)
{
pinMode(thisPin, OUTPUT);
}
}
void loop()
{ // loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 8; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer); // turn the pin off:
digitalWrite(thisPin, LOW);
delay(timer);
}
// loop from the highest pin to the lowest:
for (int thisPin = 7; thisPin >= 2; thisPin--)
{
if(thisPin = // turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer); // turn the pin off:
digitalWrite(thisPin, LOW);
delay(timer);
digitalWrite(thisPin, HIGH); // turn the pin on:
delay(timer);
digitalWrite(thisPin, LOW); // turn the pin off:
delay(timer);
}
thanks in advance,
e