# programing two potentiometers in robotc

How do you program two potentiometers on for lift and one for pick-up in robotC

Try clicking on Robot, at the top of the RobotC screen. Scroll down to Motors and Sensors Setup. After that, click on Analog Sensors, then click on the button and select Potentiometer for each port you want each pot to be plugged into. Give each pot its own name, for example LiftPot or whatever you desire.

Here are a couple of screen shots of what to expect to see:

Remember that pots can turn only about 260 degrees, after which they break. If you need full revolutions or multiple turns, use an encoder.

http://cdn.robotc.net/pdfs/vex/curriculum/Potentiometers.pdf

this should help alot, tis my goto resource for potentiometers

hope this helps !

That doc is a good start, but remember that it was written for Vex PIC.

The Cortex reads the potentiometer with a range of 0-4095.

Terry

Are these two potentiometers on the same axle or two different axles?

I am assuming you are trying to keep a linear motion of two arm motors not directly chained together on a double reverse four bar linkage. If you are looking to program two different axles with their own motor control, you should figure out the relationship of where you want pot 2 to be relative to pot 1’s current position.

Team 81M did this in sack attack on an arm and scoop. If you like I can PM you the excel sheet used to figure out the critical functions. But it’s not that tough. There were separate functions for scoop on floor at about a 10 degree angle, scoop in carry position, and scoop in dump position. Buttons did all the magic to switch between target states.

Get a spreadsheet up and measure pot 1 and where you want pot 2. Do this for a number of points and do regression on the points to get a good line which makes a function. A linear regression can work many times but you won’t go wrong with a second order polynomial for a complex movement. If you use excel, make sure it is a scatter plot. A line plot does not do what you expect. From the curve fit function, pop that as your target value for pot 2 based upon pot 1 and make a control loop (PID was used by 81M but a P or PD loop would probably work just fine).

“Scoop at the floor at a nice soft angle” position was toughest as the PID sometimes overshot and caused some scraping, so some backstops on the control loop may be in order. Adjust as necessary

You also have to be careful about the pot slipping from the screws. You need to recalibrate and make a new function once and a while when you see it is off. Once you have the data in Excel once it’s not that tough to repeat the calibration.