Potentiometer help

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;
angle = angle + vexRT[Ch2];



You while loop will be running very fast, as you are accumulating joystick values into the angle variable it will become very large or very small almost instantaneously (and also overflow). This means that the lock_carm function will probably only see a value of c that is outside of the range of the potentiometer.

Perhaps change angle to be this.
angle = 300 + vexRT[Ch2];

That will cause angle to be in the range 173 to 427.

an alternative would be to add a delay in the while loop.
would slow down how much angle could change with each iteration.