Shop OBEX P1 Docs P2 Docs Learn Events
Is there a counter like command? — Parallax Forums

Is there a counter like command?

mobehunmobehun Posts: 10
edited 2014-05-25 06:20 in General Discussion
I want to make a program that counts how many times I pressed a button but I don't really know if there is a counter command like in C programming language.

Comments

  • LeonLeon Posts: 7,620
    edited 2014-05-24 04:03
    Just increment a variable each time the button is pressed. You will need to debounce the button, of course.
  • T ChapT Chap Posts: 4,223
    edited 2014-05-24 04:17
    You also need a way to pause the code until the button is released, else the loop watching the button will keep repeating and adding more button detections.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2014-05-25 06:20
    mobehun wrote: »
    I want to make a program that counts how many times I pressed a button but I don't really know if there is a counter command like in C programming language.

    In PBASIC, Spin, or what?
Sign In or Register to comment.