UPDATE:
First, thanks for posting all that additional code too Richard. I've saved your 2nd code as "Richard's Gate Controller" on my programming PC and it is running my gate.
On to my update...
It appears I've located the cause of the erratic operation, I use sockets for PIC's and did on this project too. It looks like it's the socket causing the problems, that is, when strange things start happening, I remove and re-seat the PIC in the socket or even just press down firmly on the PIC and it's all good again.
I think there is some oxidation on my socket and GPIO.3 (input pin) starts loosing contact and picking up random noise.
I need to find some type of cleaner to use (vinegar ?) to clean the socket real good then maybe use some silicone grease to keep air and any moisture from getting to them. even though it's in a sealed enclosure. Any suggestions anyone ?
thanks
Bookmarks