int timer = 100;
int thisPin;
int numPins;
void setup() {
Serial.begin(9600);
Serial.println("How many LEDs do you want to use?");
Serial.println("Maximim is 11 pins");
while (numPins == 0){
numPins = Serial.parseInt();
}
Serial.print("You have selected ");
Serial.print(numPins);
Serial.println(" pins");
thisPin = 2;
while (thisPin <= numPins + 1)
{
pinMode (thisPin, OUTPUT);
thisPin++;
}
}
void loop() {
thisPin = numPins + 1;
while (thisPin > 1)
{
digitalWrite (thisPin, HIGH);
delay (timer);
digitalWrite (thisPin, LOW);
thisPin--;
}
thisPin = 2;
while (thisPin < numPins + 1)
{
digitalWrite (thisPin, HIGH);
delay (timer);
digitalWrite (thisPin, LOW);
thisPin++;
}
} // End of Program