Is there an equivalent to the
waitUntil
function in VCS C++?
Is there an equivalent to the
waitUntil
function in VCS C++?
I mean you could do:
while(sensor < targetvalue);
Or if you want a simple wait amt of time you can do:
task::sleep(timeinmiliseconds);
Darn it, I really liked the waitUntil command. Thanks though.
You could always make a function called waitUntil and have a while in it.
waitUntil(SensorValue > 100);
is equivalent to:
while(SensorValue < 100);
I got used to it pretty quick going from RobotC to VCS. It’s just looks different, it has the same function.
#define waitUntil(CONDITION) while(!(CONDITION))
Should work. I would recommend just getting used to writing
while
's, though, as you can do things like:
while(!(condition)) {
this_thread::sleep_for(1);
}
The explicit call to a yielding method like sleep will help keep your program switching threads smoothly and not lock up on a check that won’t change for a good long while.