Quote:
Originally Posted by seg9585
I'm trying to interpret exactly what are are looking to do with Button 4 and Button 5.
As-is:
It appears that when nothing is pressed, the PID target is always 1.17 (pot min)
When Button 4 is pressed, the PID target becomes 3.9 (pot max)
When Button 5 is pressed, the PID target becomes -(3.9 - 1.17) + 1.17 = -1.56 (out of range)
For this "Home" button are you trying to drive to a mid-value?
If so, when a button is pressed, you should be setting the setpoint to [(3.9-1.17)/2]. You can just put this into a Case structure where the selected Button determines the Case, and if True, run the PID loop. If false, use your other turret logic to specify your motor power.
If this is not what you are trying to do, please describe explicitly your desired function (what you want each button to do, etc).
|
What i want to do is when button 5 is pressed the turret to turn from a range 0 (0 being my home position ) to 90 degrees to the right and button 4 to do the same in the opposite direction
For the home button i want to be able to push a button and no matter were the turret is it returns to home position automatically when button is pressed.