
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?
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
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.
Thanks for your help! My project is now functioning properly - what a relief. I wasn't exactly sure what I needed to include w/Select & Code, but after going through it I got a much clearer understanding of what I needed & was able to use IF THEN ENDIF statements to make it work. I think I just need a little more time to fully understand the case directive. I am just a beginner so it's all pretty new to me. I'll probably keep messing w/it to see if I can get the case directive figured out for future use. Thanks again!
Parralax also has a lot of helpful reference documents for the Basic Stamp and for their Sumo Bot robots that use the those processors. The Sumo Bot documents have a lot of good example code for the Stamp.
Here are a few, hope they help!
http://www.parallax.com/dl/docs/prod/stamps/web-BSM-v2.2.pdf
http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/SumoBotMan.pdf
http://www.parallax.com/dl/docs/books/edu/RoboticsV2_2.pdf
And another I have on my Dropbox that I couldn't find quickly online:
https://dl.dropbox.com/s/85hqfc5sp0mioxy/AppliedSumo-v1.0.pdf?dl=1
Privacy Statement | Terms & Conditions | Careers | webmaster@digikey.com |
|
701 Brooks Avenue South, Thief River Falls, MN 56701 USA Phone: 1-800-344-4539 or 218-681-6674 or Fax: 218-681-3380 |
|||||||||

Quick Links:














