Line Sensor Help

Hi, I am having troubles with creating a functional line sensor, any tips?

#pragma config(Sensor, in1, lineFollowerRIGHT, sensorLineFollower)
#pragma config(Sensor, in2, lineFollowerCENTER, sensorLineFollower)
#pragma config(Sensor, in3, lineFollowerLEFT, sensorLineFollower)
#pragma config(Motor, port2, frontRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, backRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, frontLeft, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port5, backLeft, tmotorVex393_MC29, openLoop, reversed, encoderPort, None)
#pragma config(Motor, port6, beltMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, rotationMotor, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, clawMotor, tmotorVex393_MC29, openLoop, encoderPort, None)
#pragma config(Motor, port9, armMotor, tmotorVex393_MC29, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++

  • The left joystick Y-axis controls the robot’s forward and backward movement.
  • The left joystick X-axis controls the robot’s left and right movement.
  • The right joystick X-axis controls the robot’s rotation.
  • The Code incorportes a threshold/deadzone that allows very low Joystick values to be ignored.
    This allows the robot to ignore values from the Joysticks when they fail to center at 0,
    and provides a margin of error for the driver when they only want the robot to move in one axis.

[I/O Port] [Name] [Type] [Description]
Motor Port 2 frontRight VEX Motor Front Right motor
Motor Port 3 backRight VEX Motor Back Right motor
Motor Port 4 frontLeft VEX Motor Front Left motor
Motor Port 5 backLeft VEX Motor Back Left motor
--------------------------------------------------------------------------------------------------*/

task main()
{
//Loop Forever
while(1 == 1)
{
//Remote Control Commands
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[backRight] = vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
motor[backLeft] = vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];

	////________________________________________________________________________________________________________
	//above is the code for the wheels which allows wheels to move in a 350 degrees rotation.

	if(vexRT[Btn7U] == 1)       	//If button 7U is pressed...
	{
		motor[armMotor] = 127;    	//...raise the arm.
	}
	else if(vexRT[Btn7D] == 1)  	//Else, if button 7D is pressed...
	{
		motor[armMotor] = -127;   	//...lower the arm.
	}
	else                      		//Else (neither button is pressed)...
	{
		motor[armMotor] = 0;      	//...stop the arm.
	}
	//////______________________________________________________________________________________________________
	//above is the code for the arm which allows it to move up and down


	// Open, close or do not more claw
	if(vexRT[Btn6U] == 1)       	//If Button 6U is pressed...
	{
		motor[clawMotor] = 127;  		//...close the gripper.
	}
	else if(vexRT[Btn6D] == 1)  	//Else, if button 6D is pressed...
	{
		motor[clawMotor] = -127; 		//...open the gripper.
	}
	else                      		//Else (neither button is pressed)...
	{
		motor[clawMotor] = 0;    		//...stop the gripper.
	}
	////_______________________________________________________________________________________________________________
	//above is the code for the claw allowing it to open and close

	if(vexRT[Btn7L] ==1)			//If button 7L is pressed
	{
		motor[beltMotor] = 127;  		//Move the Conveyor belt forward
	}
	else if(vexRT[Btn7R] == 1)  	//Else, if button 7R is pressed...
	{
		motor[beltMotor] = -127; 		//Move the Conveyer belt backwards.
	}
	else                      		//Else (neither button is pressed)...
	{
		motor[beltMotor] = 0;    		//...stop the Belt.
	}
	////____________________________________________________________________________________________________________
	//above is the code for the conveyor belt allowing it to move back and forth
	if(vexRT[Btn8R] ==1)			//If button 8R is pressed
	{
		motor[rotationMotor] = 63;  		//Rotates the claw
	}
	else if(vexRT[Btn8L] == 1)  	//Else, if button 8L is pressed...
	{
		motor[rotationMotor] = -63; 		//Move the Conveyer belt backwards.
	}
	else                      		//Else (neither button is pressed)...
	{
		motor[rotationMotor] = 0;    		//Dont rotate
	}
}
{
	if(vexRT[Btn8D] ==1)
		wait1Msec(2000);          // The program waits for 2000 milliseconds before continuing.

	int threshold = 505;      /* found by taking a reading on both DARK and LIGHT    */
	/* surfaces, adding them together, then dividing by 2. */
	while(true)
	{

		// RIGHT sensor sees dark:
	}
	if(SensorValue(lineFollowerRIGHT) > 505)
	{
		// counter-steer right:
		motor[frontLeft]  = 63;
		motor[frontRight] = 0;
	}
	{
		// CENTER sensor sees dark:
		if(SensorValue(lineFollowerCENTER) > 505)
		{
			// go straight
			motor[frontLeft]  = 63;
			motor[frontRight] = 63;
		}
		// LEFT sensor sees dark:
		if(SensorValue(lineFollowerLEFT) > 505)
		{
			// counter-steer left:
			motor[frontLeft]  = 0;
			motor[frontRight] = 63;
		}
		else                      		//Else (neither button is pressed)...
		{
			motor[frontLeft] = 0;    		//Dont rotate
			motor[frontRight] = 0;
		}
	}
}

}

Well, first, your formatting here makes it very hard to read your code. You have some pre-formatted and some not. It looks like you placed your whole line follow inside main() but after the while(1==1) loop, so you’ll never get to it.

If you move it inside the while(1==1) loop, it should sort of work, but not really. The problem will then be that you’re trying to set your motors with the joystick axes and with the line tracker. The easiest solution would be to put an if-else statement in there, one option for the remote control and the other with the line tracking code. Use a boolean to record which state you’re in. And then set up a button or two buttons to toggle this state.