Thank you for pointing out that the AttachInterrupt() documentation covers that delay() doesn’t work in ISR. Also for the link to the extensive interrupt discussions! Very useful.
I admit I did not review the AttachInterrupt documentation, because I am not using that. I just set up a 1 second timer interrupt. The documentation for interrupts() doesn’t cover this either. I still recommend that delay() documentation be updated to include a line that it won’t work reliably inside interrupt routine.
I know interrupts should be quick. This application monitors slowly changing inputs and creates even slower outputs. One second resolution is sufficient. All the code is in the ISR and executes in less than 100mS, so mostly the processor is waiting. Probably it would be better to use the ISR to just set a flag, and pole that in the main loop.
// disable global interrupts
// clear TCCR1A and TCCR1B
TCCR1A = 0;
TCCR1B = 0;
// set compare match register to desired timer count:
OCR1A = 15624;
// turn on CTC mode:
TCCR1B |= (1 << WGM12);
// set CS10 and CS12 bits for 1024 prescaler:
TCCR1B |= (1 << CS10);
TCCR1B |= (1 << CS12);
// enable timer compare interrupt:
TIMSK1 |= (1 << OCIE1A);
// enable global interrupts:
// All action done in interrupt routine
// This is the Main Routine
// delay() isn’t reliable here