Motors get stuck running

So here is the problem 6 of my motors get stuck running and will not respond to the joystick
They are: Port 1, 6, 7 and 10 and its not just one and twn its six and seven as well

#pragma config(Motor,  port1,           arm1,          tmotorNormal, openLoop)
#pragma config(Motor,  port2,           frontRight,    tmotorNormal, openLoop)
#pragma config(Motor,  port3,           frontLeft,     tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port4,           backRight,     tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port5,           backLeft,      tmotorNormal, openLoop)
#pragma config(Motor,  port6,           arm2,          tmotorNormal, openLoop)
#pragma config(Motor,  port7,           arm3,          tmotorNormal, openLoop)
#pragma config(Motor,  port8,           ,              tmotorNormal, openLoop)
#pragma config(Motor,  port9,           ,              tmotorNormal, openLoop)
#pragma config(Motor,  port10,          arm4,          tmotorNormal, openLoop)

task main()
  //Create "deadzone" variables. Adjust threshold value to increase/decrease deadzone
  int X2 = 0, Y1 = 0, X1 = 0, threshold = 15;

  //Loop Forever
  while(1 == 1)

        //Create "deadzone" for Y1/Ch3
      if(abs(vexRT[Ch3]) > threshold)
        Y1 = vexRT[Ch3];
        Y1 = 0;
      //Create "deadzone" for X1/Ch4
      if(abs(vexRT[Ch4]) > threshold)
        X1 = vexRT[Ch4];
        X1 = 0;
      //Create "deadzone" for X2/Ch1
      if(abs(vexRT[Ch1]) > threshold)
        X2 = vexRT[Ch1];
        X2 = 0;

      //Remote Control Commands
      motor[frontRight] = Y1 - X2 - X1;
      motor[backRight] =  Y1 - X2 + X1;
      motor[frontLeft] = Y1 + X2 + X1;
      motor[backLeft] =  Y1 + X2 - X1;

      if(vexRT[btn5U] == 1)
        motor[arm1] = 127;
        motor[arm2] = -127;
        motor[arm3] = -127;
        motor[arm4] = 127;
      else if(vexRT[btn5D] == 1)
        motor[arm1] = -127;
        motor[arm2] = 127;
        motor[arm3] = 127;
        motor[arm4] = -127;
        motor[arm1] = 0;
        motor[arm2] = 0;
        motor[arm3] = 0;
        motor[arm4] = 0;

      if(vexRT[btn6U] == 1)
      else if(vexRT[btn6D] == 1)

Which six motors are not responding?
I only see you list four: 1, 6, 7, 10 (the four arm motors)

Instead of the if statements, you could write:
motor[arm1] = (vexRT[btn5U] - vexRT[btn5D]) * 127;


Marginal english

My interpretation:

Thanks for including your code, I’ll cut and paste it to try it out.

It has compiler warnings. You have eg btn5D when it should be eg Btn5D
Try fixing that first.

Then do cut/paste for your real code, or attach it as a zip file.
When you retype it, you are likely to generate new errors that mask the original errors.

To repeat this for all 4 arm motors gives the minor chance that releasing the button while executing this code will give different instructions to different motors. SPA seems like a good programming practice, to read the sensors and buttons only in one place, then decide what to do, then do it.

As an example of SPA methodology, you could try this method to split Planning from Acting, and merge all arm motor movements into one place. My version of RobotC for Cortex (v3.08 fw0.12 Mar7,2012) uses keyword tmotorServoContinuousRotation, not tmotorNormal.

 #pragma ... change arm2,arm3 to type reversed.
 int arm_m = 0;  // variable to split  sense&plan from Act

// Sense and plan
      arm_m = 0;     // default
      if ( vexRT Btn5U ] == 1 ) { arm_m = +127; }
      if ( vexRT Btn5D ] == 1 ) { arm_m = -127; } // last = highest priority

// Act,  now that var arm_m  has correct value, assign all arm motors
      motor[arm1] = arm_m; 
      motor[arm2] = arm_m; // pragma takes care of reverse direction.
      motor[arm3] = arm_m; 
      motor[arm4] = arm_m; 

That’s true.
The idea of my code still holds true, though–you can accomplish what was done with a series of if/else statements with a simple arithmetic assignment. The benefit of if/else statements would be setting a priority (i.e. pressing “Down” is more important than “Up” when both are pressed).


So far everyone has been discussing your programming style. I stared at the code for several minutes expecting to find one of the usual simple problems, however, logically it all looks good.

Now I tried it on my cortex with V3.08 and it has these warnings.

Warning:Mismatched typedefs. Converting typedef ‘TButtonMasks’ to typedef ‘TVexJoysticks’, value ‘Ch3’
Warning:Mismatched typedefs. Converting typedef ‘TButtonMasks’ to typedef ‘TVexJoysticks’, value ‘Ch2’
Warning:Mismatched typedefs. Converting typedef ‘TButtonMasks’ to typedef ‘TVexJoysticks’, value ‘Ch3Xmtr2’
Warning:Mismatched typedefs. Converting typedef ‘TButtonMasks’ to typedef ‘TVexJoysticks’, value ‘Ch5’

change btn5U to Btn5U (and the three others) as jgraber suggests and it will work. I have not seen this problem with ROBOTC before, looks like a new bug.