Robot C code downloading but operator control doesn't work...

Hello there,

So I was programming the operator control and when i run the code the robot doesn’t seem to respond when driver control is enabled on the Competition Switch.

The code for the operator control is as shows, however I couldn’t find any errors within it…

task usercontrol()
	while (true)
		//Remote Control Commands
		motor[frontRight] = vexRT[Ch1] - vexRT[Ch3] - vexRT[Ch4];
		motor[backRight] =  vexRT[Ch1] - vexRT[Ch3] + vexRT[Ch4];
		motor[frontLeft] = vexRT[Ch1] + vexRT[Ch3] + vexRT[Ch4];
		motor[backLeft] =  vexRT[Ch1] + vexRT[Ch3] - vexRT[Ch4];

		 if(vexRT[Btn5U] == 1)
		   motor[lift1] = 127;
		   motor[lift2] = 127;
		   motor[lift3] = 127;
		   motor[lift4] = 127;
		 else if(vexRT[Btn5D] == 1)
		   motor[lift1] = -127;
		   motor[lift2] = -127;
		   motor[lift3] = -127;
		   motor[lift4] = -127;
		   motor[lift1] = 0;
		   motor[lift2] = 0;
		   motor[lift3] = 0;
		   motor[lift4] = 0;



It looks fine. You don’t even need the switch to run user control. I would try some thing simple like motors on for user control to determine if the problem is with the controller connection. Maybe try no switch which I would be surprised if its broken.

OK, so what are you saying I need to change?

I was just suggesting ways to figure out what the problem is. Just put with in the while loop one line of code which turns on a motor for user control. When you run user control and the motor turns on maybe its the controller input, if the motor doesn’t turn on its another problem.


task usercontrol()
	while (true)
	    motor[frontRight] =100;


I’ve had problems like this before. I’ve tried everything and nothing worked except for this one silly fix.

*]Update all firmware over again.
*]Create a new competition template.
*]Copy and paste old code snippets into the new template.
*]Upload to cortex.

It could always be a simple syntax error within the code. Sometimes it was just easier for our team to just create a new template and paste our old code there and it would fix the problem.

Best regards!

Hello there,

I have copied our code into a new competition template and the error is still happening…

I have updated the Robot C firmware and master CPU firmware and that hasn’t solved the issue…

I have also added in a print to LCD display line after task operator control and that doesn’t show up which means it isnt reaching that part of the code…


How do you reset Robot C to default settings?

You have no pragma at the top. Go into ‘motor and sensor setup’ and add in all the motors to the correct ports. Let me know if you need more help with that.

Do you mean at the end of the program? If that’s the case, any code after a while(true) will never run. :slight_smile:

Try to open one of the example programs, and run that. If the problem persists with that is is hardware issue, possibly the connection or field switch. Also, to run driver control, you never need a field switch. When there is no switch connected, the robot is automatically in driver control.

As has been pointed out, you are missing the pragma at the top. I had assumed that you already configured your motors and sensors (if applicable) and just didn’t copy paste it, but if you haven’t done that, that should fix it.

So what you’re saying is that because the operator control code is in a while(true) loop, it will never run?

I do have pragma’s but I am showing you just the operator control section of the code…

Sent you a PM. I will sort this out tomorrow for you.