Potentiometers in Java - Basic Rundown/Resources?


#1

Hi, our team is utilizing potentiometers to move an arm to desired angles. We have been utilizing the wpilib resource but are still having a difficult time understanding how to get to certain angles with our arm using said analog (not linear) potentiometer. How would we go about this in Java, and are there any resources we could use? We’ve scoured the internet to no avail. Thanks!


#2

See here: https://wpilib.screenstepslive.com/s/currentCS/m/java/l/599718-analog-inputs

Section on “Reading Analog Values.” Basically, you you move the arm to where you want it to be, then you get the value. Write it down on a sheet of paper. Then move to the next point, get the value, write it down, etc…

Then, when you code your robot, you’ll write an function like “MoveArmToThisAnalogReading.” It will look at the current analog reading, decide whether to move up or down and go there. (See the section on PID ).