VEX controller not working

task main()

{

while(1==1)
{
	motor(backleft) = vexRT[Ch2];
	motor(backright) = vexRT[Ch2];
	motor(frontleft) = vexRT[Ch3];
	motor(frontright) = vexRT[Ch3];

}
if(vexRT[Btn8D] == 1)
{
motor(claw) = -127;
}

	else if (vexRT[Btn8D] == 1)
	{
		motor(claw) = -127;
	}

	else
	{
		motor(claw) = 0;
	}
	if(vexRT[Btn8U] == 1)
	{
		motor(claw) = 127;
	}

	else if (vexRT[Btn8U] == 1)
	{
		motor(claw) = 127;
	}

	else
	{
		motor(claw) = 1;
	}
	


	{
	startMotor(frontleft, 127);
	startMotor(backleft, -127);
	startMotor(frontright, 127);
	startMotor(backright, -127);
}

}

that is my code ^
The problem is that when I link up a controller it will work for a few seconds and then stop and then repeat the process until i stop.
I have tried using my friends controller to make sure it isnt the controller that is the problem. It seems to be the code.

Must add, this is my first time on the forum and also my claw button doesn’t work

This may help

@CHarrell. Most likely that wont help, @Sharkoder is using RobotC.

@Sharkoder. The while (1==1) Loop needs to be for the entire part of your main code, you only have it doing the movement in the next 4 lines. You need to move the } after the 4 motor commands to the end of the program.

1 Like

It’s been so long since i’ve used it i didn’t even notice lol.