i know this i damn stupid. but i dont know how to count the number of times a tacltile button is pressed with a bs2
count = 0everytime bs2 sees
count = 0
everytime bs2 sees a button push make count = count + 1
also make sure that you
also make sure that you debounce the button if needed or your count will higher than the number of times you actually push the button.
That reminded me to tell you
That reminded me to tell you to make sure your code doesn’t add another 1 until the button is released. Plus as stated above a press is sometimes seen as many presses since the circuit is opened and closes many times (if the processor is fast enough) for each 1 press of the button. You need to:
Detect when button is pressed
PAUSE a small amount of time
ADD 1 to count
Detect when button is released
Go back to detection for button press
i dont really get what you
i dont really get what you are saying
when you push a button it
when you push a button it snt just a push. The switch can bounce and case the PIC to see it as a lot of pushes since the switch can bounce high and low for a few milliseconds with each push.
as in like, i dont get the
as in like, i dont get the program and how it works with a basic stamp 2. well, i can debug in7(connected to button) = 1 when i press the button. but i want to count the number of times it is press. maybe if im more specific in what i am using this for, u may be able to help me more. basically, this is used for my mini sumo. when the button is pressed once, mode 1 is used, when i press the button twice, mode 2 is used. This goes on until mode 5. i also want to be able to go to mode 2 without going to mode one, so there must be some sort of activating thing?
I am not familiar with basic
I am not familiar with basic stamp 2 code all I can do is give you psudo code that you have to translate.
Check the BUTTON command in
Check the BUTTON command in the Basic Stamp manual, specifically made to debounce switches. (Page 137)