Shop OBEX P1 Docs P2 Docs Learn Events
Help with Push Button Game Please! — Parallax Forums

Help with Push Button Game Please!

EschattEschatt Posts: 16
edited 2009-02-27 07:23 in BASIC Stamp
Hi,
I have hit a wall recently. I am trying to count how many times a push button is pushed in 8 seconds, at the end of the 8 seconds, ideally the basic stamp would be able to turn on an LED. Signaling that the push button was hit the correct number of times in the 8 seconds (for my example I used 4 times). I have tested the push button with a simple debug code and it is working properly. I have attached the code that I have been working with to this post. Is what I described possible? and if so am I on the right track? Any help would be much appreciated! Thanks!
-Eschatt

Comments

  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-26 23:43
    Why don't you try the COUNT command? It would be a lot simpler.

    For example:

    COUNT 10, 8000, variable······· ' Count how many times IN10 equels 1 in 8 seconds and store it in variable

    IF (variable = 4) THEN··········· ' If clicked 4 times

    · High LED··························· ' Insert whatever you want it to do here.

    ELSEIF (variable <> 4) THEN··· ' If is not clicked 4 times

    · GOTO Beginning·················· ' Goto the beginning

    END





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
  • EschattEschatt Posts: 16
    edited 2009-02-27 00:08
    Hi,
    Sounds great, but, when the push button is pressed it is 0 for a second or so (several lines on the debugger). Do I need to change anything so that each push is counted as only one zero (do I need to/can I change the frequency of how often the BS2 checks IN10 while using the COUNT command)? Thanks.
    -Eschatt

    Post Edited (Eschatt) : 2/27/2009 1:06:31 AM GMT
  • Dan TaylorDan Taylor Posts: 207
    edited 2009-02-27 07:23
    I am not sure if you could incorporate the DEBUG menu to show when the pushbutton is pressed or not in the program that I showed you. Maybe someone more experienced than me could help.

    Do you even need the debugger?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dan Taylor
Sign In or Register to comment.