Cortex ports broken

Ever since we got our cortex(this year) we’ve had problems with motors. They will only move at a jerky/pulsing movement(some are just outright broken), which is kind of a pain for our arm to lift up the stars. It is not a motor issue, I’ve switched the ports on motors and the issue stays with the port. Motor controllers aren’t the problem either. It’s not the controller because, as I said, the problem stays with the port. It’s not the code either. Do we need to get a new Cortex, or is there another possible problem I’m not aware of? If we could get a fix before state that would be great. Anything helps.
realreal.zip (634 Bytes)

I’m having trouble opening the zip file on my iPad but are you 100% sure it is not a coding error? It’s entirely possible to have a code compile and download because there is no technical error in the code but if you don’t properly use your if/else statements you might be setting a certain port to 0 and 127 which would cause the jerky motion. Try a “dummy code”, super simple just write a code that sets all the ports equal to 127 and plug a motor in one at a time. That being said it is entirely possible to have a non working port on a cortex but it’s worth checking the code.

Okay so the code

if(vexRT(Btn6D) == 1){
    	motor[arm] = 127;
    }else{
      motor[arm] = 0;
    }
    if(vexRT(Btn6U) == 1){
    	motor[arm] = -127;
    }else{
      motor[arm] = 0;
    }

Means that if 6U is pressed and 6D isn’t you are sending both 0 and -127. If both are pressed you send -127 and 127. etc

if(vexRT(Btn6D) == 1){
    	motor[arm] = 127;
    }else if(vexRT(Btn6U) == 1){
    	motor[arm] = -127;
    }else{
      motor[arm] = 0;
    }

This way you only send power to each motor once.

Also your autonomous code

task autonomous() {
	motor[arm] = -127;
	wait1Msec(2000);
	motor[arm] = 0;
  motor[FR] = -63;
	motor[FL] = -63;
	motor[BR] = -63;
	motor[BL] = -63;
	wait1Msec(2700);
	motor[BR] = 0;
	motor[BL] = 0;
	motor[FR] = 0;
	motor[FL] = 0;
}

looks like it is going to stall your lift motors.

Here’s the code contained in the zip file:

#pragma config(Motor,  port2,           FR,            tmotorVex393TurboSpeed_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port3,           FL,            tmotorVex393TurboSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor,  port4,           BR,            tmotorVex393TurboSpeed_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port5,           BL,            tmotorVex393TurboSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor,  port8,           arm,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port9,           arm,           tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX2)
#pragma competitionControl(Competition)

#include "Vex_Competition_Includes.c"

void pre_auton()
{
    bStopTasksBetweenModes = true;

}

task autonomous() {
    motor[arm] = -127;
    wait1Msec(2000);
    motor[arm] = 0;
    motor[FR] = -63;
    motor[FL] = -63;
    motor[BR] = -63;
    motor[BL] = -63;
    wait1Msec(2700);
    motor[BR] = 0;
    motor[BL] = 0;
    motor[FR] = 0;
    motor[FL] = 0;
}

task usercontrol() {
    while (true) {
        motor[FL] = vexRT(Ch3);
        motor[BL] = vexRT(Ch3);
        motor[BR] = vexRT(Ch2);
        motor[FR] = vexRT(Ch2);
        if(vexRT(Btn6D) == 1){
            motor[arm] = 127;
        }else{
            motor[arm] = 0;
        }
        if(vexRT(Btn6U) == 1){
            motor[arm] = -127
        }else{
            motor[arm] = 0;
        }
    }
}


First, you’ve named two motor ports the same thing in the pragmas. Instead of trying to name both ports the same thing, give them two related names. Here:


#pragma config(Motor,  port8,           arm1,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port9,           arm2,           tmotorVex393_MC29, openLoop)

Next, you should refer to both arm ports, not just one. So, the autonomous becomes:


task autonomous() {
    motor[arm1] = -127;
    motor[arm2] = -127;
    wait1Msec(2000);
    motor[arm1] = 0;
    motor[arm2] = 0;
    motor[FR] = -63;
    motor[FL] = -63;
    motor[BR] = -63;
    motor[BL] = -63;
    wait1Msec(2700);
    motor[BR] = 0;
    motor[BL] = 0;
    motor[FR] = 0;
    motor[FL] = 0;
}

And the usercontrol becomes:


task usercontrol() {
    while (true) {
        motor[FL] = vexRT(Ch3);
        motor[BL] = vexRT(Ch3);
        motor[BR] = vexRT(Ch2);
        motor[FR] = vexRT(Ch2);
        if(vexRT(Btn6D) == 1){
            motor[arm1] = 127;
            motor[arm2] = 127;
        }else{
            motor[arm1] = 0;
            motor[arm2] = 0;
        }
        if(vexRT(Btn6U) == 1){
            motor[arm] = -127
            motor[arm1] =-127;
            motor[arm2] = -127;
        }else{
            motor[arm1] = 0;
            motor[arm2] = 0;
        }
    }
}


So, rolling in @tabor473’s very useful change, and putting it all together you have:


#pragma config(Motor,  port2,           FR,            tmotorVex393TurboSpeed_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port3,           FL,            tmotorVex393TurboSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor,  port4,           BR,            tmotorVex393TurboSpeed_MC29, openLoop, reversed, driveRight)
#pragma config(Motor,  port5,           BL,            tmotorVex393TurboSpeed_MC29, openLoop, driveLeft)
#pragma config(Motor,  port8,           arm1,           tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor,  port9,           arm2,           tmotorVex393_MC29, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX2)
#pragma competitionControl(Competition)

#include "Vex_Competition_Includes.c"

void pre_auton()
{
    bStopTasksBetweenModes = true;

}

task autonomous() {
    motor[arm1] = -127;
    motor[arm2] = -127;
    wait1Msec(2000);
    motor[arm1] = 0;
    motor[arm2] = 0;
    motor[FR] = -63;
    motor[FL] = -63;
    motor[BR] = -63;
    motor[BL] = -63;
    wait1Msec(2700);
    motor[BR] = 0;
    motor[BL] = 0;
    motor[FR] = 0;
    motor[FL] = 0;
}
task usercontrol() {
    while (true) {
        motor[FL] = vexRT(Ch3);
        motor[BL] = vexRT(Ch3);
        motor[BR] = vexRT(Ch2);
        motor[FR] = vexRT(Ch2);
        if(vexRT(Btn6D) == 1){
            motor[arm1] = 127;
            motor[arm2] = 127;
        }else{
            motor[arm1] = 0;
            motor[arm2] = 0;
        }
        if(vexRT(Btn6D) == 1){
    	    motor[arm1] = 127;
    	    motor[arm2] = 127;
        }else if(vexRT(Btn6U) == 1){
    	    motor[arm1] = -127;
    	    motor[arm2] = -127;
        }else{
          motor[arm1] = 0;
          motor[arm2] = 0;
        }
    }
}


One more thing: How many motors are you running on the arm? you only have two ports, so to be legally wired, that’s either two, three, or four motors. May not be enough depending on gearing.