PDA

View Full Version : simple program problem



Annoying
03-09-2010, 08:12 AM
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.

Mike Green
03-09-2010, 08:17 AM
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 "[ code ]" / "[ /code ]" tags (without the extra spaces) or use the Attachment Manager that you get when you use the Post Reply button.

Annoying
03-09-2010, 08:42 AM
thanks I just attached the file, hopefully that helps.

Annoying
03-10-2010, 12:40 PM
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.·