how do you count...
ERM
Posts: 34
Can you use the button command to count the length of time for a button being pressed?· I want to be able to count when a button is pressed for 3 seconds.· Is this possible?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=============================================================================================================================================
Name=Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
· DEBUG DEC timer, CR
... where you want to see the timer value.· Note that if you put this in the loop you will affect the loop timing (slow it down a·bit)·as DEBUG takes time to operate.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=============================================================================================================================================
Name=Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
' {$STAMP BS2}
' {$PBASIC 2.5}
StartBtn PIN 3
timer VAR Byte
minute VAR Byte
minute = 60
Main:
DO : LOOP UNTIL (StartBtn = 1)
PAUSE 1050
timer = timer + 1
DEBUG CLS
DEBUG ? timer
IF timer = 60 THEN GOTO subtract
GOTO main
subtract:
timer = timer - minute
GOTO main
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
=============================================================================================================================================
Name=Chris
=============
Age
12
======
grade
7
Webpage
Email=miniwarrior@cox.net
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax