Shop OBEX P1 Docs P2 Docs Learn Events
IF THEN ELSE-Statement — Parallax Forums

IF THEN ELSE-Statement

tucson.warrentucson.warren Posts: 8
edited 2012-07-30 13:20 in BASIC Stamp
New to programming and need help. Is there anyway to use the THEN logic statement to simply post a DEBUG remark. Such as: If (IN3=1) THEN DEBUG "IN2 needs to be low". Appreciate any advice. Thank you, Warren

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-30 11:45
    Yes, that's exactly how you'd do it. You can put the DEBUG statement on a single line with the IF/THEN like this:

    IF IN3=1 THEN DEBUG "Oops, IN3 is high",CR

    or on multiple lines like:

    IF IN3=1 THEN
    DEBUG "Oops, IN3 is high",CR
    ENDIF

    The CR is a constant name that is equal to 13 which is a carriage return character.

    If you haven't gone through it yet, I'd recommend that you read (and work through the exercises) from "What's a Microcontroller?" that you can find here along with a lot of other educational material.
  • tucson.warrentucson.warren Posts: 8
    edited 2012-07-30 13:20
    Mike,
    Thanks for the reply. I left out the CR and the DEBUG editor kept going to the THEN line and giving me an error message; like error 152 and I couldn't figure out where to find the list of associated error definitions assigned to the message number (still don't). Will try again tonight after work. -Warren
Sign In or Register to comment.