In a section of code that counts manual switch presses, I'm trying to use Time to exit if the switch remains idle for 5 seconds.
During simulation, the program waits forever in the do:loop, as if the time function is not counting seconds. The "BLINK" stuff was added just to watch it in simulation. No problem as long as I keep pressing and releasing SW1, but it will wait forever without timeout if I stop. HELP!
Tommy Tyler
Code:
#Picaxe 08M2
#No_Data
Setfreq M4
symbol SW1 = pinc.3
symbol UHF = pinc.4
low c.0
low c.1
low c.2
IDLE:
enabletime
time = 0
do:loop until SW1 = on or time => 5
if SW1 = on then goto BLINK
if time =>5 then END
endif
goto IDLE
BLINK:
do:loop until SW1 = off
high c.0
pause 2000
low c.0
goto IDLE
Tommy Tyler