Hey guys, my team and I recently switched to RobotC and while the switch was pretty fluid, we are stuck on this one problem. We need a motor to stop when a potentiometer reaches a certain reading. We tried:
if (SensorValue[pot] > 3508)
{
motor[swerve] = 0;
}
Previous in the program we link that motor to:
motor[swerve] = vexRT[Ch1];
However, once that potentiometer reading is hit, the motor stops temporarily but goes on to twitch past if the joystick is held. Is there anyway to have it so that the joystick can be held but the motor does not go past that point? And if not, how could we program it so that the motor goes until it reaches that point then stops?
Any help would be much appreciated.