Potentiometer PID

hahaha
wow. this is what no sleep does to you.
thanks for that.
maybe I just think weird or something

how do u get pot sensors to work on easy c?

The Analog Input block,

The Analog Input function block allows the user to define behavior based on signals from any analog sensor. Analog sensors provide a range of feedback with the range depending on the actual sensor being used. This generic input can be used with any Analog device of your choosing.

pot.JPG


pot.JPG

I can’t agree more. We just call our controllers when the robot is enabled. Dead simple and works great.

I think the same way… and so therefore there is no official programming mentor who actually looks over my code anymore (=

i would advise against using a pot for PID control, because the pot will always be returning to the same position, and the brush inside the pot will wear down on the resistive material, which would sacrifice the signal’s validity. Im not saying that something like a joystick wouldnt do this, but a joystick is a lot more replaceable than a robot.

I guess I am comfused and I have been trying to get an idea on all this. I wish to be able to move the joystick to say a value of 200, then I want on the robot a motor to turn an arm until it also reads another pot at the same angle.

Example:
Joystick tilted slightly forward, thus arm tilted slightly down.

I cant figure out do I use a PID loop or do I just get creative with some other code or use a table? In the past I would just use limit switched but II want better control this year and a more varied location.

-Mike

Use the sample code that has been bandied about in this thread, but instead of setting Target with conditionals and hardcoded values, just set Target equal to the value coming in from your joystick axis, or some function of that value (for instance, target=p1_y*4; would give you access to the full range of the pot). Does that make sense?

Do I have to use Kevin’s ADC code added somewhere within my code or could I just copy the code from Dustinb_3?

Any help is greatly appreciated the robot is about done but we’ve been busy on that and waited til the last minute to work on completing the code.

-Mike

Do a simple proportional control…


arm_motor = (arm_pot - p1_y) * 50;

dont multiply by 50, multiply by something that actually makes the arm move smoothly.