Thank you. It is the delayMicroseconds() part of the interrupt service routine which is interactive with the timer.
While delayMicroseconds() works within the ISR, the entire ISR is taking a long time to finish. Other interrupts are disabled within the ISR, and the Timer0 overflow interrupt which drives the millis count is being blocked.
One thing to do to correct this is to re-enable interrupts within the ISR. This can lead to problems, but in your case, where the ISR completes before the next zero cross interrupt occurs, I think it will be OK.
Add this first line to the ISR
void zero_crosss_int() // function to be fired at the zero crossing to dim the light
{
sei(); //re-enable interrupts
//rest of isr
The entire approach to ac phase management using delayMicroseconds() is simple and functional, but indeed can create problems with more than simple sketches. There is an alternative approach using the hardware Timers to control the triac delays which is shown in the ac phase control tutorial. Adapting it for two outputs is even more complex.Arduino Playground - ACPhaseControl