Corrections: Blink w/o Delay

Please make the following corrections…

unsigned long previousMillis = 0;

unsigned long interval = 1000;

if(currentMillis - previousMillis >= interval) {

why?

I don't see a clear reason to make those modifications, though I have to admit the last one makes sense for clarity of the concept

The other ones are not really affecting the context we are using this example for.

/d

why?

I don't see a clear reason to make those modifications

    previousMillis = currentMillis;

If you are going to store an unsigned long value somewhere, shouldn't the somewhere also be an unsigned long.

We point people to the Blink Without Delay example all the time, when what they want to do might require that both variables be the correct type.

As an example, the example should define best practices. And best practices call for copy values between variables of the same type UNLESS you know the risk, and are prepared to deal with the possible loss of data.

though I have to admit the last one makes sense for clarity of the concept

The last one is not a question of clarity it is a question of correctness. ">" is simply not correct. The delay is 1001 milliseconds not 1000. For most applications, it won't matter. For some, it matters a great deal.

It is clear from the forum that people use that example, verbatim, in their own work without realizing that example is buggy.