Code help

Need some help with my code. all my buttons seem to not be working

#pragma config(Motor, port9, rightMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port2, leftMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port3, leftarmMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port4, midMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port8, rightarmMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port5, clawMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port7, liftMotor, tmotorNormal, openLoop, reversed)

task main()
{
while(1 == 1)
{
motor[rightMotor] = vexRT[Ch1] + vexRT[Ch2];
motor[leftMotor] = vexRT[Ch1] + vexRT[Ch2];
motor[rightarmMotor] = vexRT[Ch3]+ vexRT[Ch4];
motor[leftarmMotor] = vexRT[Ch3]+ vexRT[Ch4];

	if(vexRT[Btn5U] == 1)  
	{
		motor[midMotor] = 127;
	}
	else if(vexRT[Btn5D] == 1)  
	{
		motor[midMotor] = -127;  
	}
	if(vexRT[Btn6U] == 1)   
	{
		motor[liftMotor] = 127;   
	}
	else if(vexRT[Btn6D] == 1)  
	{
		motor[liftMotor] = -127;  
	}
	if(vexRT[Btn7U] == 1)   
	{
		motor[clawMotor] = 127;   
	}
	else if(vexRT[Btn7D] == 1)  
		motor[clawMotor] = -127;   
}

i don’t quite know what is going on with the code, you will have to give a little more detail, are there any errors? does anything happen when you press the buttons? or does it do nothing?

Also, remember to add an else statement to the end of the button functions, otherwise the motors will move forever, until you reverse the direction. Example :


if(vexRT[Btn7U] == 1) 
{
motor[clawMotor] = 127; 
}
else if(vexRT[Btn7D] == 1) 
motor[clawMotor] = -127; 
}
else{
motor[clawMotor] = 0;
}

EDIT: look over this tutorial and see if you did something wrong:
http://www.education.rec.ri.cmu.edu/products/cortex_video_trainer/lesson/media_files/rc_buttons.pdf

First, why are your right and left motors given exactly the same values? You can’t turn. And if that’s the goal, why use two joystick values instead of one? I suspect you wanted to create arcade control, but one of them needs a - instead of + in there. The arm motors have the same questionable code. If you want them doing the same thing, why not use one joystick? If you want them doing different things, why give them the same values?

Second, as mentioned above, you want an else with the buttons to set them to 0 so they don’t just keep running one way or the other.