task autonomous() // right side autonomous is in place right now
{
resetMotorEncoder(clamp1);
resetMotorEncoder(clamp2);
SensorValue[rightencoder] = 0;
SensorValue[leftencoder] = 0;
if(SensorValue[potent] < 1200)
{
motor[lift1] = -127;
motor[lift2] = -127;
}
else if(SensorValue[potent] > 1200)
{
motor[lift1] = 0;
motor[lift2] = 0;
}
if(SensorValue[rightencoder] > -1000)
{
motor[motor1] = 63;
motor[motor2] = 63;
motor[motor3] = 63;
motor[motor4] = 63;
}
else if(SensorValue[rightencoder] < -1000)
{
motor[motor1] = 0;
motor[motor2] = 0;
motor[motor3] = 0;
motor[motor4] = 0;
motor[clamp1] = 63;
motor[clamp2] = 63;
}
Using the above code our lift is supposed to stop when the potentiometer reaches a value greater than 1200, yet it does not and instead the lift just raises all the way up. Why?