Dane:
Arrch:
Declare global variable to keep track of the time that the switch has remained in it's position.
Record the edge time for when the switch changed states.
Keep checking for the the time it's been since it's been switched (millis() - timeSwitched) and compare that to your interval time.Yes that's what I thought initially, but how do I avoid overwriting the timeSwitched with millis() everytime the IF statement checks to see if the switch is still HIGH?
Thanks!
Remember the previous state of the switch, and only record the 'start time' when you see the switch change to state B. This is what Arrch refers to as the edge time.