#pragma config(Motor,  port2,           leftMotor,     tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor,  port3,           FleftMotor,    tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor,  port4,           rightMotor,    tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port5,           FrightMotor,   tmotorVex393_MC29, openLoop, reversed, driveRight)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main ()
{
  int threshold = 10;   // helps to eliminate 'noise' from a joystick that isn't perfectly at (0,0)
                        // feel free to change this to match your needs.

  while(1 == 1)
  {
    if(abs(vexRT[Ch2]) > threshold)         // If the left joystick is greater than or less than the threshold:
    {
      motor[leftMotor]  = (vexRT[Ch2])/2;   // Left Joystick Y value / 2.
    }
    else                                    // If the left joystick is within the threshold:
    {
      motor[leftMotor]  = 0;                // Stop the left motor (cancel noise)
    }

    if(abs(vexRT[Ch2]) > threshold)         // If the right joystick is greater than or less than the threshold:
    {
      motor[rightMotor] = (vexRT[Ch2])/2;   // Right Joystick Y value / 2.
    }
    else                                    // If the right joystick is within the threshold:
    {
      motor[rightMotor] = 0;                // Stop the right motor (cancel noise)
    }

    if(abs(vexRT[Ch2]) > threshold)         // If the right joystick is greater than or less than the threshold:
    {
      motor[FrightMotor] = (vexRT[Ch2])/2;   // Right Joystick Y value / 2.
    }
    else                                    // If the right joystick is within the threshold:
    {
      motor[FrightMotor] = 0;                // Stop the right motor (cancel noise)
    }
    if(abs(vexRT[Ch2]) > threshold)         // If the right joystick is greater than or less than the threshold:
    {
      motor[FleftMotor] = (vexRT[Ch2])/2;   // Right Joystick Y value / 2.
    }
    else                                    // If the right joystick is within the threshold:
    {
      motor[FleftMotor] = 0;                // Stop the right motor (cancel noise)
    }
  }
}
