As usual need Help
Guido
Posts: 195
I am having difficuilty in trying to come up with an idea for counting contact closures in a 10 second window. The results of the calculation will have four different goto statements. The program would wait for the first contact closure and monitor and count·for ten seconds....Any Ideas?
Thank You
Guido
Thank You
Guido
Comments
At the possible risk of sounding all too obvious, you may want to take a look at the COUNT command. I suspect that will do exactly what you want, although you may have to extend the time frame a bit.
Regards,
Bruce Bates
· DO : LOOP UNTIL (Trigger = 0)···· ' wait for first press
· DO : LOOP UNTIL (Trigger = 1)···· '·force release
· COUNT Trigger, 10000, presses··· ·' count other presses
You'll have to adjust the timing parameter for other modules
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Thank you for your response. Reading about the Count statement, I am worried that the final count might not be accurate. The reason I am saying this, my count will be triggered by a momentary contact closuser anywhere from .5 to 3 seconds apart. Also the first count will be initialized in the main program, which will then goto your example loop program:
·DO : LOOP UNTIL (Trigger = 0)···· ' wait for first press
·DO : LOOP UNTIL (Trigger = 1)···· '·force release
·COUNT Trigger, 10000, presses··· ·' count other presses
I assume I could just add +1 to the Count trigger statement. but how would I initialailize the Trigger=0 Loop and start the timer if that would be the only contact closuser....
Thank You
Guido