So I ran this code hoping that the motor would just wiggle around the point that I set the potentiometer to and it did but then I added a variable called angle so that it could add the input from the controller to that value that it has to stop at but after I downloaded it looked like the controller input just controlled the motor itself. I don’t know if it’s just me being stupid and not knowing how potentiometers work or if it’s something else. Here’s the code(Note: I’m just testing this out and not bringing it to a competition).
#pragma config(Sensor, in1, test2, sensorPotentiometer)
#pragma config(Motor, port2, test, tmotorServoContinuousRotation, openLoop)
void lock_carm(int c){
if (SensorValue[in1] < c) {
motor[port2] = 60;
}
else {
motor[port2] = -60;
}
}
task main()
{
int angle = 300;
while(true){
angle = angle + vexRT[Ch2];
lock_carm(angle);
}
}