"UNTIL" command in Easy C???????

does anyone know if there is any way to make a “until” command in Easy C???
for example:

motor #_ turn clockwise
“UNTIL” limit switch == 0

If anyone knows of a way to do this, or if there is an alternative way of doing this, PLEASE answer.

thanks

Replace your pseudocode above with this:

while (limit_switch != 0) { //Spin until limit_switch == 0 }

Blake

:eek: do you mean to make a while loop with this: while (limit_switch != 0) { //Spin until limit_switch == 0 }?
if so, then what do you mean with the {}?
I dont really understand what you mean, could you try to rephrase it?
sorry for the trouble

Yes

The braces containing only a comment mean that each time the while statement’s test is true, the computer will “execute” a comment (i.e. it will do nothing). The computer will sit and do this “nothing” over and over again (it will “spin”) until the while test’s result is false. Then the computer will execute the next statement (the one after the while loop’s block).

Does this help?

Blake

I think so, thanks Blake!

You could also use the “if” command in the same way.


if (limit_switch != 0)
{
//Code to make motor/whatever move until limit_switch = 0
}
else 
{
//Do the regular stuff
}