I'm trying to figure out how I would go about triggering a relay 12 times over a 24 he period. I've been looking for some sample code to try and break down but I haven't had any luck. Does anyone have any sample code they could provide?
I'd go for an RTC such as a DS1307 driven by this library and then use this alarm library.
Another approach is to use the millis() function if 100% accuracy is not important and you can handle the rollover - every 50 days or so.
2 Hours is 7,200,000 milliseconds, that is if you want the relay to be triggered at 2 hour intervals.
You'll also have to specify for how long the relay should be triggered (X seconds).
Rollover is not an issue as long as arithmetic with unsigned longs is subtraction and NOT addition.