Wait_For_2Sec:
timer = 0
Check_Input:
IF IN1 = 0 THEN Wait_For_2Sec
timer = timer + 1
PAUSE 50
IF timer < 40 THEN Check_Input
This version looks at the input every 50 milliseconds to make sure that the input hasn't been released then repressed during the delay period.· It forces the button to be pushed for two seconds (40 x 50 ms·= 2000 ms) before moving on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
Depends on your definition of "work." What Sid's demo does is wait for the input, waits two seconds, then checks it again. Since the Stamp can't look at inputs while it's doing a PAUSE instruction, the input could be released, then reengaged and you'd never know it. Now, you said you wanted the input to be active·for 2 seconds. My version is a refinement of Sid's that, techically, could suffer the same fate, though it's far less likely that a user could release and repress the button inside a 50 millisecond window.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Jon Williams
Applications Engineer, Parallax
Dallas Office
Comments
if in1 = 1 then
pause 2000
if in1 = 1 then mode1
endif
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Try the Stamp Tester
http://hometown.aol.com/newzed/index.html
·
This version looks at the input every 50 milliseconds to make sure that the input hasn't been released then repressed during the delay period.· It forces the button to be pushed for two seconds (40 x 50 ms·= 2000 ms) before moving on.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
if in1 = 1 then
pause 2000
if in1 = 1 then mode1
endif
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Hold the microswitch in for 2 seconds
when it is held in for 2 seconds it goes into mode1
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office