Shop OBEX P1 Docs P2 Docs Learn Events
BS1 Program Help — Parallax Forums

BS1 Program Help

n0wiqn0wiq Posts: 8
edited 2009-08-12 16:43 in BASIC Stamp
I think I am being confused about the use of IF <condition> THEN on a BS1.

I had used:
IF p5 = 1 THEN

t2 = 120

t1 = 240

ELSE

t1 = 120

t2 = 240

END IF

and the IF p5 THEN is asking for a label to go to. I had understood that I could use the IF <condition> THEN the way I had entered it.

Post Edited By Moderator (Joshua Donelson (Parallax)) : 8/12/2009 4:20:42 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-08-12 15:40
    When compiling code for a BS1, the Stamp Editor uses an older syntax where there is no ELSE or ENDIF. You would need to write:

    IF p5 = 1 THEN label1
    t1 = 120
    t2 = 240
    GOTO label2
    label1:
    t2 = 120
    t1 = 240
    label2:

    Notice that the two blocks of code were switched. You need to do that or change the = to <>
  • n0wiqn0wiq Posts: 8
    edited 2009-08-12 16:43
    Thank you. I guess I have been using high level languages too long.
Sign In or Register to comment.