Inconsistent Shaft Encoder

i’m having trouble getting consistent # of revolutions with our quadrature shaft encoders. At first a value of 360 “ticks” gave us two revolutions. Then when tested again maybe 10 minutes later the gear did not revolve the same number of revolutions and a value of 270 gave the gear one full revolution. Then, once again, when i ran the program again the value gave more than a revolution. basically our shaft encoders seem to be needing different values for one revolution each time we test the program. One value may work for a few trials, but when left alone for a few minutes the value needed to get one revolution changes. So could someone show me exactly what i’m doing wrong with my code?

task main()
{
SensorValue[leftEncoder]=0;
SensorValue[rightEncoder]=0;

while(SensorValue[rightEncoder]>-360)
{
	motor[right]=60;
}
while(SensorValue[leftEncoder]<265)
{
	motor[left]=-60;
}

}

See my answer from yesterday.
https://vexforum.com/t/inconsistent-quadrature-shaft-enocders/38572/1

The code above will start the “right” motor while the encoder is greater than (-360). Is that what you want to do? A few tips for encoders. Change the wiring so that the encoder counts up when you command the motor with a positive value. It gets really confusing if positive commands make the encoder go backwards. Once an encoder (and motor) reach the target encoder count, you need to stop the motor, otherwise the motor (and encoder) will keep moving.