NXC - command execution times
Posted: 12 Feb 2012, 19:33
Using NXC, I’m trying to get a better grasp on when commands are executed.
Let’s say I’ve got the following the code:
Am I right in thinking that pretty well straight after Motor A starts turning, Motor B will start turning as well, i.e. it won’t wait for Motor A to finish.
If the above is correct, what would happen if:
Would Motor A not complete its 360 degree turn?
What is the best way to ensure that Motor A finishes its turn? I have tried inserting a Wait command after starting Motor A but results seem rather inconsistent.
Would this work?
To ensure that A finishes prior to starting B
Let’s say I’ve got the following the code:
Code: Select all
RotateMotor(OUT_A, 30, 360);
RotateMotor(OUT_B, 40, 180);
If the above is correct, what would happen if:
Code: Select all
RotateMotor(OUT_A, 30, 360);
Off(OUT_A);
What is the best way to ensure that Motor A finishes its turn? I have tried inserting a Wait command after starting Motor A but results seem rather inconsistent.
Would this work?
Code: Select all
while(MotorRunState(OUT_A)!= OUT_RUNSTATE_IDLE)
{
}