What is the default time for delay?

which one is faster

do{
// some thing without delay
}while(1);

OR

do{
//some thing
delayMicroseconds(3);
}while(1);

or they are same ?
what is the time for default delay for any function using loop ?
and thanks.

the default time delay of the loop will be how long it takes the CPU to execute the instructions of the loop.

The faster loop is the loop without an added delay.

thank you for response.

were you thinking differently?

you ask the code to pause for 3µs during the loop - so it's of course slower... that's the point of a delay...

(Note that 3µs is the minimum delay you can expect on an Arduino like the UNO)

important note thank you

But if "some thing" takes milliseconds, the difference won't be much.

1 Like

If "some thing" includes blocking code, such as a Serial.print waiting for space in the serial buffer, the delay may make no difference at all.

1 Like