_delay_ms(1000); Vs delay(1000); 0n UNO board

hi ,

_delay_ms(1000); Vs delay(1000); - working as same on UNO board

_delay_ms(1000); consuming less memory .
delay(1000); consuming little more memory . ( close to 100 bytes morei)

there is any serious problem will come in case of using the _delay_ms(1000); in all program instead of delay(1000); ....?

How did you measure it? You probably added delay() to an empty sketch and saw the difference. This is an incorrect comparison. Operator uses system libraries, which are used in any large program without it.
By itself, the overhead from using the delay() does not exceed a few dozen bytes


Who needs the delay() function?
Actually only for testing purposes, right ?

1 Like

Compare the code with one delay() operator and with two. It will be more correct

_delay_ms() won’t call yield(), which might be important on some platforms.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.