delay inconsistent between ver 0018 and 0019

I have a simple loop using analogwrite function to vary the brightness of a LED, followed by a delay
analogWrite(ledPin, 0);
delay(1000);
analogWrite(ledPin, 15);
delay(1000);
analogWrite(ledPin, 30);
delay(1000);
analogWrite(ledPin, 60);
delay(1000);
analogWrite(ledPin, 80);
delay(1000);
analogWrite(ledPin, 100);
delay(1000);
analogWrite(ledPin, 128);
delay(1000);
analogWrite(ledPin, 255);
delay(1000);
If I compile with version 0018 of the IDE, the time between steps seems much less than 1 sec and seem to vary significantly
Compiling with 0019 , no code change, the steps are consistent and close to ! sec

Compiling with 0019 , no code change, the steps are consistent and close to ! sec

Oh good. Maybe 0019 is an improvement then.

Mowcius

IIRC there were updates in 0019 to the delay functions to address the issues in 0018. So this behavior is expected between the 2 versions.

A quick look at the release notes for 0019 and you have your answer...

The new delay should be accurate near the microseconds scale. The old delay() ought to be been accurate to within a millisecond or so, which should have been imperceptible in a 1000ms delay on a blinking LED, but was somewhat problematic when delay(1) was almost always 2ms long...

Something else may be going on here...
(which pin are you using for the LED? I wonder if there were unexpected interactions between the timer used for that pin's AnalogWrite and the timer used for milis())

I suspect that might be the problem, I thought I checked but..
I'm using a 328, pin D9 for the LED.

I assumed the timing error would be within a few counts, but it seems to var from 100mSec up to 1 sec.

I will try another pin to see if I can reproduce the error

I could not duplicate the problem here (on a 168, using the pin13 LED between each set of analogWrites...)

I think I might a a strange hardware issue with the board I tried it on, I used another 328 and it was fine

I think I might a a strange hardware issue with the board I tried it on, I used another 328 and it was fine

Hmm, strange...