Hello,
I have this code:
Is just a process that when a touch sensor is pressed for two seconds then execute a subrutine.
But I have a problem. The code jump to subrutine after 2 seconds only if I initialize the picaxe with the touch sensor pressed. In other words, when w0 > 3600 from the beginning. And if I initialize the picaxe and then touch the sensor, the code doesn't jump to subrutine as wished. I know is a code issue... please someone can tell me what is wrong with my code or what is mssing???
thank you so much!
I have this code:
Code:
#PICAXE 08M2
symbol TOUCHCONFIG = %00001001
;time = 0
main:
;pause 100
touch16 [TOUCHCONFIG], C.4,w0
if w0 > 3600 and time = 2 then
goto subrutine
else
goto main
endif
return
subrutine:
low B.2
pause 2000
high B.2 , B.0
time = 0
do
touch16 [TOUCHCONFIG], C.4,w0
if w0 > 3600 then
loop
end if
goto main
But I have a problem. The code jump to subrutine after 2 seconds only if I initialize the picaxe with the touch sensor pressed. In other words, when w0 > 3600 from the beginning. And if I initialize the picaxe and then touch the sensor, the code doesn't jump to subrutine as wished. I know is a code issue... please someone can tell me what is wrong with my code or what is mssing???
thank you so much!