Will delay() handle minutes?

I mean, I need to pause the execution of the sketch for something between 5 and 20 minutes at random. 5-20 times 60000 milliseconds gives the time in milliseconds for 5 to 20 minutes.

No issues with any interrupt, the code is very simple.

My question is: will delay() handle large values like 1200000 (=20 minutes)?


will delay() handle large values like 1200000 (=20 minutes)?

Try it for yourself. It will only take about 20 minutes.

delay() takes an unsigned long, which can be up to 4,294,967,295, as its parameter, so you can, should you want to, have a delay of up to 49 and a bit days.

delay() is looking for ‘type’ unsigned long.

unsigned long gives you about ~72 days. <—<<< ~50

Let the compiler do the math 206060*1000ul

Time to put delay() in the back pocket and bring out the big guns from the front, use BWD


The demo Several Things at a Time illustrates the use of millis() to manage timing without blocking.


The source code to delay() is available for you to look at even, its in wiring.c, search for that file and have a nosey!