Suitable alternative to delay() function for long durations

I have a simple code. Where once the output is triggered to HIGH by a GPIO, I need to hold that state for 2.5mins (150000 millis). Which is a big amount of time. I am worried whether the delay() function will be efficient enough for this operation.

Please advice on the same.

Thank You.

It depends entirely on whether or not you want your Arduino to do anything else in that time, because it won't.

If you do need it to do other stuff, like say poll digital pins for switch activations, then you need to look in the IDE at File > Examples > 2.Digital > BlinkWithoutDelay.

No. I don't want the arduino to do anything during this pause time. Nothing at all.

Shantanu24:
No. I don't want the arduino to do anything during this pause time. Nothing at all.

Well then use delay().

But it's a bit short-sighted, because one day you might think "hmmm, it would be nice be able to use all this processing power to do other stuff during that time" so it may be a good idea to use a millis() approach now.

The highest value you can use with delay is 4294967295UL resulting in a delay of exactly that many milliseconds, give or take some clock variance (approximately 49.7 days).

delay() is exactly the right tool if the intent is to do nothing except wait for 2.5 minutes.