This program just runs infinitely no matter what distance or speed I put it at.
void drive(int drive1, int drive2, int distance)
{
nMotorEncoder[rearLeft] = 0;
nMotorEncoder[rearRight] = 0;
while(abs(nMotorEncoder[rearRight]) < distance || abs(nMotorEncoder[rearLeft]) < distance){
motor[frontLeft] = drive1;
motor[frontRight] = drive2;
motor[rearLeft] = drive1;
motor[rearRight] = drive2;
}
motor[frontLeft] = 0;
motor[frontRight] = 0;
motor[rearLeft] = 0;
motor[rearRight] = 0;
}
task main()
{
drive(100,100,1);
}
(note: all the motors and the encoders are configured)