//******************************************************************************//
//                              Run Striaght                                    //
//                              (RobotC on NXT)                                 //
//										//
//  This program allows your robot to run forward until either of the motors    //
//  has reached an assigned number of rotational clicks.                        //
//                                                                              //
//******************************************************************************//
//				Focus						//
//                                                                              //
//  We use the boolean and operator "&&" in a while condition, implying that    //
//  both condition have to be true in order to execute the loop's code.         //
//                                                                              //
//******************************************************************************//
//				Notes						//
//                                                                              //
//  1. Be sure to reset the rotation sensor before comparing its value.         //
//                                                                              //
//******************************************************************************//
//                              Motors & Sensors                                //
//                                                                              //
//  To modify Motors & Sensors Configuration in Robot C, go to View -> Motors   //
//  & Sensors Setup.  This will change the automatically generated code.        //
//										//
//  [I/O PORT]    [Name]          [Type]               [Description]            //
//  Port A	  none            motor                 right motor             //
//  Port B	  none            motor                 left motor              //
//                                                                              //
//******************************************************************************//


task main()
{
   nMotorEncoder[motorA] = 0;                                            //the rotation sensor for motor A is reset to 0
   nMotorEncoder[motorB] = 0;                                            //the rotation sensor for motor B is reset to 0

   while(nMotorEncoder[motorA] < 1800 || nMotorEncoder[motorB] < 1800)   //a while loop is delcared with the rotation sensor for motor A less than 1800 AND the rotation sensor for motor B less than 1800 as its true condition
 {
      motor[motorA] = 100;                                               //motor A is run at a 100 power level
      motor[motorB] = 100;                                               //motor B is run at a 100 power level
   }
}