None of the examples you give are the simple one line example which I found somewhere. The example needed a bool state at the declaration level.
Talking about a program mysteriously changing, it has Sion. I tried an ‘if’ in front and did away with the’;’ and the program is again working perfectly. As I said previously the program without the ‘if’ and with the’;’ was working perfectly for me in several programs that I will now have to change.
The answer must be in revisions the administrators make from time to time. I will post the line `(digitalRead(pin)==HIGH && state==LOW); on the forum and ask where this particular programming appeared because now it does not work anymore. It worked for me for a long time.```
`I am picking up the high going spike all the time now from my hardware circuit with the above change. Of course I was looking for a fault in my hardware circuit. Obviously there is no fault there. The hardware sends a high going spike to Arduino at zero crossing of the mains voltage. I have come across many very complicated zero crossing detectors that didn’t work properly. In the end I designed my own very simple detector.```
``