LiquidCrystal library no delay()

I had a quick look over it. It looks like the critical part is between the detection of the Zero Crossing and switching the gate low.
One problem is that the flag ZCR which you set in the ISR to indicate the zero crossing will not be acted on until the top of the loop is reached. That could be delayed by a number of things including the servicing of the LCD.
One possibility is, in the ISR, switch the gate high and start another timer, as a one-shot timer, to switch the gate low after myTime has expired. Since that would also happen in an ISR, the speed of the loop() would not then be relevant.
You could also check ZCR around delay prone parts of your code and abandon them, if necessary, for the rest of the cycle, to make the loop faster.

1 Like