Shop OBEX P1 Docs P2 Docs Learn Events
Can I do this with the button command to test the state of six buttons? — Parallax Forums

Can I do this with the button command to test the state of six buttons?

TMartTMart Posts: 2
edited 2005-09-09 23:07 in BASIC Stamp
· DO
··· BUTTON 0,1,255,255,Workspace,1,Pressed
··· BUTTON 1,1,255,255,Workspace,1,Pressed
··· BUTTON 2,1,255,255,Workspace,1,Pressed
··· BUTTON 3,1,255,255,Workspace,1,Pressed
··· BUTTON 4,1,255,255,Workspace,1,Pressed
··· BUTTON 5,1,255,255,Workspace,1,Pressed
· LOOP

I want to test six buttons on a game, and they will stay "on" "1" after pressed while the program looks for others also pressed as the game moves on.

thanks
Ted - BeverageNJ@aol.com

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-06 15:04
    Ted,

    ·· An initial problem you're going to have with this is that you're trying to use the same workspace variable for all buttons.· This will adversely affect the button command.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 9/6/2005 3:25:55 PM GMT
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-06 15:26
    BUTTON really isn't very useful for that application -- it's cleaner to write custom code.· This will help:

    http://www.parallax.com/dl/docs/books/sw/exp/sw15.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-09-06 16:21
    Here's another URL for an example "game show" using successive detection of button responses...
    www.emesys.com/BS2fsm.htm#Game%20show

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • TMartTMart Posts: 2
    edited 2005-09-09 17:46
    First of all, thank you



    I changed the workspace element into workspace0, worspace1, etc. . . .

    Is that a good way to go about it.



    I also appreciate the other responses and am studying them to understand what they are doing, so I can grasp the concepts outlines.



    God bless

    Ted
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-09-09 18:27
    Basicall, Ted, BUTTON is not the best choice in this application -- better to use my code or Tracy's to scan and debounce multiple inputs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-09-09 23:07
    Ted,

    ·· While I was pointing out there error in your BUTTON setup, Jon and Tracy are correct.· You're better off with their suggestions.· Better to take their advice.· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.