Can anyone link me or write me an example to using PID control with servos? (HiTec if brand matters)
Can anyone link me or write me an example to using PID control with servos?
For what purpose?
I built a robot arm out of servos and would like the speed to slow as they approach the target position. Controlled via master-slave system of potentiometers
You want the slave to move slower than the master? You could put rate limiting into the code that accepts inputs and generates outputs. Say every 100th of a second you get the inputs. If the input is different from the current output, move a little in the direction of the new input. When the master stops the slave will eventually catch up and also stop.
You want the slave to move slower than the master?
No, I don't think that the master/slave relationship has anything to do with the servo speed.
So, OP, what is the problem? Using the PID library, Setpoint is where you want to be, Input is where you are, and Output relates to the speed you need to move the servo.
If you are using standard servos, you really have little control of the speed. What you control is the position. The way to control speed is to move in small steps, with pauses between steps. Long pause == slow. Short pause == fast.
The size of the step is about one degree, though using the writeMicroseconds() method can result in smaller steps.