The code above seems to do what you asked for. This code:
int timer = 700; // 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 < 6; thisPin++) {
pinMode(thisPin, OUTPUT);
}
}
void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 2; thisPin < 6; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// lower the delay if timer >= 20
if (timer >= 20) {
timer = timer - 1;
}
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}
I tried it out, the LEDs flash in sequence, gradually (very gradually) getting faster.
Is that not what you wanted?