linuxguy wrote:
kurte wrote:
So you might try:
hservo [PanServo\(PanPos*16)-2400\MoveSpeed, TiltServo\(TiltPos*16)-2400\MoveSpeed]
I will try this also.

8-Dale
Personally if it were me, I would change this part of the code into hservo units.
Change the init of the two values to 0 instead of 1500.
Change the update of values:
PanPos = (PanPos + (lhori-127)) MAX 12000 MIN -12000
TiltPos = (TiltPos + (lvert-127)) MAX 12000 MIN -12000
Then simply pass it through to the HSERVO like before...
If the pan/tilt move too slow or too fast I would then scale the values in these calculations...
Then again I like to change lots of code

Example in your code I would change the normalize function to use parameters and a return value... Something like:
Code:
Normalize[NormalizeValue, NormalizeNull]
if NormalizeValue < (NormalizeNull-DeadBand) then
NormalizeValue = (127*NormalizeValue)/(NormalizeNull-DeadBand) MAX 127
elseif NormalizeValue > (NormalizeNull+DeadBand)
NormalizeValue = (127*(NormalizeValue-NormalizeNull)/(255-DeadBand-NormalizeNull) + 127) MAX 255
else
NormalizeValue = 127
endif
return NormalizeNull
Then your code using it can look a little cleaner... Probably produces about the same results code size/speed...
Code:
Gosub Normalize[lhori, lhori_null], lhori
Gosub Normalize[lvert, lvert_null], lvert
Gosub Normalize[rhori, rhori_null], rhori
Gosub Normalize[rvert, rvert_null], rvert
Back to playing

Kurt