Increasing blinking rate

Hi,

I’m a beginner using the blink (without delay) example from the tutorial section to try and make an LED blink increasingly slower or faster, by changing the interval.

How do I use a for loop to increase.decrease the interval at the which the LED blinks?

Thanks

You don’t–instead, vary the ‘interval’ value declared near the beginning of the sketch. Smaller == faster blinks, larger == slower blinks.

I understand that you change the interval but I want it to be changing throughout the program e.g it begins at say 200 milliseconds and ends up being 5000 - I 've figured out how to do it using the delay blink sketch with a ‘for’ loop like so-

int ledPin = 13; // LED connected to digital pin 13

void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}

void loop()
{
for( int x = 0; x<5000; x++;){
digitalWrite(ledPin, HIGH); // sets the LED on
delay(x); // waits a period of time
digitalWrite(ledPin, LOW); // sets the LED off
delay(x); // waits a period of time
}
}

but I can’t get the same principle to work for the blink method without the delay.