How do you find values off of a potentiometer for an Andy Mark turn table? (what is the basic code for reading the values off of potentiometer?)
What language? You use the center pin of the potentiometer to find voltage when you connect the other two terminals to power and ground (one to power, the other to ground). Then you map that voltage between the maximum and minimum voltage you can get from the potentiometer (turn it all the way one way and all the way the other way to find that) and that’s how you get your angle relative to the minimum and maximum.
Part of the beta testing has included a new potentiometer class. It’s basically a wrapper around an analog input that lets you specify the degrees per volt (360 * #turns/5 volts * any gear ratio you want to take into account) send an offset, then read back the values as degrees.
It’s really slick and works perfectly from our testing (Java). We used it for a swerve drive project, which let us plug the potentiometer object straight into the PID loop to control steering the modules, which worked great as our equations returned an angle to turn to-do we didn’t have to do any manual calculation on the value to convert it to volts to get it to work.
Look at the AnalogChannl VIs/class.