LED Motor Check

My team has recently been having problems with motors cutting out, the problem is fixed but we would like to ensure ourselves that the motors are working each match.
Our approach on the problem would be to turn a LED on if the motor is not receiving an input from the cortex. I am unsure how to get this result with robotc.

My current code is:

		if(SensorValue[ledtouch] == 1) //Touch Sensor == 1
		motor[leftfront] = 1; //Motors On
		motor[leftrear] = 1;
		motor[rightrear] = 1;
		motor[rightfront] = 1;

The next task is to say that if the motors are off turn led 1-4 on. (one LED for each motor)

Thank you!!!

I don’t think you can do this with code (or period). For example, the best method I would say is having an encoder on each drive wheel, and monitoring the encoders to see if when you are sending signals to the motors they are turning. But if 3 of the motors are working, the encoder will still turn, giving the illusion that the motor is working.

The best solution would be an LED built into the motor or motor controller, but that’s not an option. A motor controller 2.0 that has an inactive LED would be nice though.

You can read the value being sent to a motor, i.e.

int motorValue = motor[port1]; 

will let you know what value the cortex is sending to port1. However, that will not tell you if the motor is receiving the value. All the normal failures can prevent the motor from actually turning. As @creatorthomas indicates, you will need a sensor on every motor to test for motion.