Shop OBEX P1 Docs P2 Docs Learn Events
Need to know how to use a character string as an input to debugin — Parallax Forums

Need to know how to use a character string as an input to debugin

VinceKasVinceKas Posts: 2
edited 2008-05-14 20:39 in BASIC Stamp
Need to know how to use a character string as an input to debugin. The following is a portion of a working program. I merely type in A or B into the debug screen and the program jumps to the appropriate subroutine. Now I would like to use a character srtring like LAMP1 or Lamp2 in place of A or B. The program should not jump to the subroutines until the entire string character is typed in. How do you do it?
'Declare Variables
LED·· VAR Byte
LED1· VAR Byte
LED2· VAR Byte
L1··· VAR Byte
DO
· DEBUG CLS
· DEBUG "INSTRUCTIONS", CR
· DEBUG "Enter L1 to select LED 1 Or· Enter L2 to Select LED 2", CR
· 'Enter A OR B FOR LED1 OR LED2 CONTROL
· DEBUGIN LED
· IF (LED= "I"OR"i")THEN
· GOSUB LEDONOFF1_SUBROUTINE
· ELSEIF (LED="A"0R"a")THEN
· GOSUB LEDONOFF2_SUBROUTINE
· ENDIF
· LOOP

Post Edited By Moderator (Chris Savage (Parallax)) : 5/15/2008 3:23:36 PM GMT

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-14 20:15
    Well, since you've declared "LED" as a BYTE, then "DEBUGIN LED" will only wait for one byte.

    If you declare LED as a byte array (" LED VAR BYTE(2)" ) and then use the "STR" input instead of DEBUGIN
    " SERIN 16, 16864, [noparse][[/noparse]STR LED] "

    Then, when you enter "L1<enter>" (<enter> meaning the <enter> key) then LED(0) will hold "L" and LED(1) will hold "1".
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-05-14 20:39
    VinceKas


    I·know that you are NEW to the Forum and that ok and·I welcome you to the Forum

    Please go back to your first post and put this in as· the subject line

    at the top of the page·sad.gif

    How to use a character string as an input to debugin

    Thank You for doing this·will help ·all of us that read·post on the forum· smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 5/14/2008 9:37:08 PM GMT
Sign In or Register to comment.