I need to disable a product for 2,5 hours after a certain moment and want to show the end time on the display.
I use the RTClib.h libraray and can read the actual time (now.hour() and now.minute()).
How can I add in a simple way 150 minutes to this time (only for presentation purposes).
My RTC has to run undisturbed further.
I can make the interruption routine with compairing mills().
Store the current hours and minutes.
Keep checking hours.now and hours.minutes until 2 hours and 30 minutes have passed.
Just like watching a clock on the wall.
RTClib.h offers two helper classes on top of reading time: DateTime to stores date and time information and TimeSpan to represent duration / changes in time with seconds accuracy
whilst not rocket science to do, it can help make your code easy to read as you stay within high level constructs of the library.
build a date time when the code needs to stop that is 2h30 ahead