Shop OBEX P1 Docs P2 Docs Learn Events
BS1 Button command — Parallax Forums

BS1 Button command

sjradiosjradio Posts: 3
edited 2006-10-14 03:23 in BASIC Stamp
I am using a BS1 that is monitoring multiple inputs for closures. Is it necessary for each button command to have it's own bytevariable?

· Symbol·btn1 = b0
· Symbol btn2 = b1

· BUTTON 0,0,255,0,btn1,1, gosomewhere
· BUTTON 1,0,255,0,btn2,1, gosomewhereelse

or can the button command for all buttons·use the same workarea?

· Symbol·btn = b0

· BUTTON 0,0,255,0,btn,1, gosomewhere
· BUTTON 1,0,255,0,btn,1, gosomewhereelse

The BS1 button command requires that the pin be defined 0-7, no variables are allowed.

Thank you,

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2006-10-14 03:23
    Each button has to have its own variable because the button commands need to be executed repeatedly (in a loop) and the variable keeps the state of the button, the debouncing, and repeat information.
Sign In or Register to comment.