RobotC Code for going, stopping, and turning for 2 seconds

Here is some code that will provide functions you can call to move the robot forward, stop, or turn the robot for 2 seconds. You may have to adjust the time it turns to get the angle you want.

void goRobot(){
//just makes them go
motor[leftMotor] = 127;
motor[rightMotor] = 127;
}
void stopRobot(){
motor[leftMotor] = 0;
motor[rightMotor] = 0;
}
void right90(){
//use a timer to turn 90.
//goes partial speed to make the turn more reliable
clearTimer(T1); //resets timer T1 to 0
while (time1[T1] < 2000){ //as long as timer T1 is less than 2 seconds
motor[leftMotor] = 64;  //set left motor forward 64
motor[rightMotor] = -64;  //set right motor back 64 (turning right — if motors are set up that way)

}
stopRobot();
}