Shop OBEX P1 Docs P2 Docs Learn Events
simple program problem — Parallax Forums

simple program problem

AnnoyingAnnoying Posts: 50
edited 2010-03-10 05:40 in BASIC Stamp
so I want my program to do something once a condition is satisfied, and STAY IN THE LOOP within the IF statement·until a different condition happens,
which doesn't work:

IF pulse2 < 1895 AND pulse1 > 3108· THEN···
DO
GOSUB GetOtherValue
PULSOUT 9, 800
LOOP UNTIL pulse1 < 1895
ENDIF

ANY SUGGESTIONS?? THANK YOU. through debug statements I found out that it executes the contents of the if statement only once.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-09 01:17
    Somehow, you need to have the DO / LOOP so it contains the IF statement.· It's impossible to give you more specific advice without more information about what the rest of the program is doing or supposed to do.· If you include a piece of code in a forum message, please either use the "[noparse][[/noparse] code ]" / "[noparse][[/noparse] /code ]" tags (without the extra spaces) or use the Attachment Manager that you get when you use the Post Reply button.
  • AnnoyingAnnoying Posts: 50
    edited 2010-03-09 01:42
    thanks I just attached the file, hopefully that helps.
  • AnnoyingAnnoying Posts: 50
    edited 2010-03-10 05:40
    something weird I noticed as I was debugging: It actually does remain inside of the DO...LOOP inside of the IF statements if I just print a word in the debug terminal while it's looping infinitely. but for some reason when I put the PULSOUT command for the servo in the DO...LOOP, it exits the loop even though it should not. why·does the servo command interfere?? so confusing.·
Sign In or Register to comment.