linuxguy wrote:
I just tried your new code. It does work for positioning the Pan servo. I have to install a servo for the Tilt, so have not checked that yet. Is there any way to get the sticks to auto center when they are not being operated? That does not seem to be happening now.
If what you desire is for the pan and tilt to mimic the position of the joystick, then you can simplify the code. That is instead of looking at the current position, you simply scale the Joystick return values. That is you could do something like:
Code:
IF (ABS(DualShock(3)-128) > TravelDeadZone) THEN
hservo [Turret\(Dualshock(3) - 128)*4) \100]
ELSE
hservo [Turret\0 \100]
ENDIF
Personally I don't think this will work very well, as the joystick return values are not fluid.
Other options:
1) TImeout - if the joystick has been at the center position for a certain amount of time, set it to zero point.
2) use a button like: clicking the joystick to say Move me back to the idle position.
Kurt