Skip navigation
TechXchange
Digi-Key TechXchange Communities > Projects and Designs > Discussions
10010 Views 4 Replies Latest reply: Dec 14, 2012 10:00 AM by MetMan RSS
Currently Being Moderated

Dec 10, 2012 3:28 PM

Programming Basic Stamp

I’m looking for some tips on programming basic stamp.  My project is similar to a Simon game so I programmed a pattern (didn't use random as it's way over my head) & need to write the programming for recognizing if the player performed the pattern back correctly.  I thought I had it with IF THEN ENDIF statements, but it’s not working the way I hope.  Any advice?

  • MetMan Apprentice 91 posts since
    Oct 24, 2011
    Currently Being Moderated
    Dec 10, 2012 6:23 PM (in response to MMauer)
    Programming Basic Stamp

    Hard to tell what the problem is just from your description.  Can you post a schematic or some of your code?

  • Spider99 Novice 7 posts since
    Feb 24, 2012
    Currently Being Moderated
    Dec 11, 2012 11:03 AM (in response to MMauer)
    Programming Basic Stamp

    MMauer,

    You can use the "Case" directive. It goes like this.

     

    SELECT

    Expression

     

     

    CASE

    Condition(s)

     

     

    Statement(s)

     

     

    { CASE

    Condition(s)

     

     

    Statement(s)

     

     

    CASE ELSE

     

    Statement(s)

    }

     

    ENDSELECT

    Function

    Evaluate Expression and then conditionally execute a block of code based on comparison to Condition(s). After executing a block of code the program continues at the line that follows ENDSELECT. If no conditions are found True and a CASE ELSE block is included, the CASE ELSE code statements will execute.

    • Expression is a variable, a constant or an expression.
    • Condition is a statement, that can be evaluated as True or False. The Condition can be a very simple or very complex relationship, as described below. Multiple conditions within the same CASE can be separated by commas ( , ).
    • Statement(s) is any valid PBASIC statement or statements. Multiple statements may be placed on the same line (though not recommended) by separating each statement with a colon ( : ).

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 3 points