Code Help Please -- Counting Button Presses
dk_akj
Posts: 37
Hi,
This code gives me trouble.
It is supposed to count how many times pin 4 goes high.
FOR i = 1 TO 4
· DEBUG "press button x times" , DEC i,CR,LF
· COUNT 4, 25000, m_PulseCount
· DEBUG "got " , DEC m_PulseCount,CR,LF
NEXT
It counts, but it counts way to many, if i press the button 4 times it counts 8 or 10.
I have a 10K pulldown resistor on pin 4.
Can it be the button bounching ? It is the printbutton that i gor with my education board.
What can I do to solve my problem ??
//akj
Post Edited By Moderator (Jon Williams) : 8/17/2004 8:39:43 PM GMT
This code gives me trouble.
It is supposed to count how many times pin 4 goes high.
FOR i = 1 TO 4
· DEBUG "press button x times" , DEC i,CR,LF
· COUNT 4, 25000, m_PulseCount
· DEBUG "got " , DEC m_PulseCount,CR,LF
NEXT
It counts, but it counts way to many, if i press the button 4 times it counts 8 or 10.
I have a 10K pulldown resistor on pin 4.
Can it be the button bounching ? It is the printbutton that i gor with my education board.
What can I do to solve my problem ??
//akj
Post Edited By Moderator (Jon Williams) : 8/17/2004 8:39:43 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I'll try that.
//akj
Now it works
I'm using the button function.
//Akj