Motor Encoder assistance[Turning]

We are currently have an issue with Motor Encoder. This is our first time dealing with Motor Encoders.
When making the Motor Encoder deal with assisting the robot in moving a certain degree, is their a way to make sure it actually stops after doing it’s task?
When we tried getting the correct amount of Turn Ticks, the robot would always move according to the time.
For Example:


If you were to change the time to, (2000) the robot continues to rotate throughout the 2 seconds.
Is this normal?

Make sure you’re turning off your motors after the turn. Also, turning with encoders is suboptimal, and can often lead to a pretty major turn error. If possible, invest in a gyro (which is compatible with both Cortex and V5). Would recommend this article by @biglesliep

We do have the motors turned off.


motor[port3] = 0;
motor[port5] = 0;
motor[port2] = 0;
motor[port4]= 0;

It would be good to post the code for autoTurnEncoder().

Get rid of that wait1Msec(1000); entirely. That’s your problem. You finish your turn (theoretically, assuming autoTurnEncoder() works), and then you keep the motors running for another 1000 ms before turning them off.

Inside autoTurnEncoder(int speed, int angle) (guessing at those two), your code should look something like

motor[port3] = speed; // not sure which motors turn together and which opposite
motor[port5] = speed;
motor[port2] = -speed;
motor[port4]= -speed;
while(encoder value is less than desired as calculated here or prior to here) {

Here is the code we originally had.

I’m not used to RobotC, but should that first line (and similar with the second line) be this:

nMotorEncoder[port5] = 0;

Anyway, as I said before, you really need to delete that wait1Msec(1000); command entirely. Otherwise your motors are going to keep spinning at speed*0.8 for that whole 1000 ms.

(Not sure what autoTurnTime() is.)