If the angle changes from 0 to 90 degrees which would be the reading of the potetiomenter? Is there any calibration’s possibilities?
Thank you.

Every potentiometer is slightly different, so it is impossible to say for sure.
Best to put it on the robot, manually turn the mechanism to the locations you want to know the values for, and use the debugger to read them off.

Also be careful that you don’t try and measure positions too close to the physical limits of rotation on the potentiometer - the values might not change at all until you’ve gone maybe 10 degrees in from either end

be sure not to raise your arm all the way through the limiter
we did

Vex Pot has a physical range of ~270 degrees, and a useful range of ~250 degress.
Robots that need to measure an arm angle of only 90 degrees sometimes run a chain and sprocket from arm axle to pot axle to increase the rotation.
Robots that need 270 degree arm rotation have to gear down the pot to avoid hitting the stops.

Calibration is usually done by using a limit switch at one end of the arm movement to say “whatever the current pot value is, thats the bottom”

Alternately, you can put an additional hand-operated calibration pot on the robot, and compare the arm pot to the cal-pot to decide when to stop.
That lets you tweak the calibration pot as your robot sits on the field, sinking into the foam more or less than it does on the table.
That also lets the calibration pot vibrate to a different position during the match.

1 Like

Sometimes a limit switch is not available space-wise.

Calibration is typically needed on these things. It’s really a variable resisitor in there and we’ve seen variations from day to day for some reason. So before every comeptition we re-calibrate and re-download the porgam. It takes no more than 5 minutes once you’ve done it a few times.

Set the various key values in #define or const int variables at the top of your code and run it through the debugger with a tape measure or the goals and objects themselves. I am sure after unpacking you should recalibrate anyway. Who knows how loose that thing got in transit.

example off the top of my head…
#define TOP_GOAL (2010)
#define MIDDLE_GOAL (1490)
and so on…

While the range of values is pretty big, you don’t want to have your robot trying to fight through a floor limit or a physical stopping point or be short of that goal height. You also don’t want floor being 0 as was mentioned above. Play in the middle of the range if possible. The Cortex gives a much wider range than the old PIC ones but it’s all relative.

1 Like

How would you program the potentiometer (if, else if, else, >, <,) into vexcode text? All I know how to do is show the current value. I would like to know how to set limits for motor with it, please.

Read the value from the potentiometer and compare it to a desired limit. When you reach the limit stop the arm. As stated above, make sure your potentiometer is mounted correctly so you dont rotate and break it.
Potentiometers only go 270 degrees, or so I’ve heard