I've looked at the blink without delay method, but I'm not sure how good it is for a long delay.
I need to trigger something every 7 hours, which converts to 25 200 000 milliseconds. I also have 1 sec delays in my code which I assume will also affect the accuracy of the milliseconds.
Any recommendations for which way I should approach this?
delay(25200000) // :)It is ok, there is room for 4 294 967 296 milliseconds - it is a unsigned long parameter.
If you need to have both a one second and a 7 hour, then use the method outlined i the NoDelayBlink, where you loop and check if milli() has increased 25200000 since you last "fired" the 7 hour code. And this will be acurate, evn if your 7 hour code takes minutes of CPU time (the milli() stuff increments via a timer interrupt)
The acuracy is limited by the crystal. It will be in the same ballpark accuracy wise as any ordinary watch.
I have quite a few delay functions in my code, all switching relays and such, which are all going to put the milliseconds way out of line. I think it would be possible to tap these into the no delay code, but would be very time consuming!
I have seen the ibutton RTC used in quite a few applications, would this be worth looking into?
I just ran a short test and it turns out the delay functions don't really interfere much with the millisecond counts. For every 60 seconds, its out by around 0.5 second.
Which equates to 210 seconds every 7 hours. Which is a perfectly acceptable ratio for my uses.