Shop OBEX P1 Docs P2 Docs Learn Events
LCD and IF statements — Parallax Forums

LCD and IF statements

csprousecsprouse Posts: 4
edited 2008-11-03 02:58 in BASIC Stamp
I am programming the BS2 to display stuff on an LCD. Baby stuff for you all. Why do IF statements cause the programs to ask for 'labels'?
thanks.

Comments

  • GICU812GICU812 Posts: 289
    edited 2008-11-02 23:02
    Not sure what you mean, but your typical IF .. Then statement should go like
    x var byte

    If x > 3 then gosub bigger

    If x = 5 then
    x=3
    gosub five
    endif

    bigger:
    Debug "X is bigger"
    return

    five:
    Debug "X is 5"
    return
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-11-02 23:06
    csprouse said...
    I am programming the BS2 to display stuff on an LCD. Baby stuff for you all. Why do IF statements cause the programs to ask for 'labels'?

    Normally they don't.
    Can we see the code you're using that causes this problem? Use the attachment manager (below) to attach it to your post.
  • csprousecsprouse Posts: 4
    edited 2008-11-03 01:01
    I didn't try using a subroutine, just your typical if, this program is just an alarm clock. Really appreciate your help.
    I hope the code attached.
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-11-03 01:29
    Try clicking the PBasic Language 2.5 button at the top of the screen (see the little "1.0 2.0 2.5" buttons?).

    I just hooked up a BS2 with an LCD, added the "2.5" and ran your program - it seems to work just fine. The "IF...THEN...ELSE" structure is only found in PBasic 2.5: that's why you're getting weird results when you don't include the compiler directive.

    Post Edited (sylvie369) : 11/3/2008 1:46:43 AM GMT
  • csprousecsprouse Posts: 4
    edited 2008-11-03 02:09
    You are right! That was a rookie mistake. Cheers!
  • sylvie369sylvie369 Posts: 1,622
    edited 2008-11-03 02:58
    Glad to help.

    I make it a habit to use both the $STAMP and the $PBASIC directives in every program. There are other mysterious glitches waiting to pounce if you don't.
Sign In or Register to comment.