Hi Steve, The code picks up a low to high going pulse. In my application it is picking up a pulse at zero crossing of the mains voltage. The code following it does not execute if the pulse is not received. The program keeps looping until it picks up the pulse.
The line “`(digitalRead(pin)==HIGH && state==LOW);” with the curly brackets following worked for me for a long time. Then suddenly it stopped working. I could see nothing wrong with my zero crossing circuit. I then tried “if” in front of the above but made the mistake of leaving in “;” because an if statement doesn’t have this. ```
`And now as I said it is again working perfectly. You are right now the previous line I used now does nothing and the part in curly brackets is executed all the time. But this is not how it was for a long time. It worked with that line. That is why I think during one of the updates to Arduino the earlier line was made ineffective. ```
It makes more logical sense to have an “if” before digital read.