andyquirot
Member
Hi all I am (Have) fitted a pot in the turrent of a 1/8th scale Chieftain Tank and if i read the pot and output the result to a servo controling the elevation as i lift or lowae the frount of the tank the barrel stayes wher it is. I i then read a radio control signel from the reciver and feed it to the servo the barrel will move up and doun as required. So what's the problum you may well ask.
Well i cant combine the two inputs i am no good at maths and need some help to do the maths PLEASE.
---------------------------------------------------------------------------------------
'Using a pot for gun barrel stiblision File Name Gun Gyro01
'PICAXE-08M connections are:
' Leg 1 +5V
' Leg 2 (Serial in) Tie to Ground through 10K resistor
' Leg 3 (In4/Out4) Wiper of 5K potentiometer connected to +5V and ground
' Leg 4 (In3) Pulse input from radio receiver
' Leg 5 (In2/Out2) Pulse output to servo
' Leg 7 (Out0/Serial Out) NC
' Leg 8 Ground
symbol Angle=b8 'Name the delay factor
symbol PWin=w0 'Name the input pulse length
symbol PWout=b2 'Name the output pulse length
main:
pulsin 3,1,PWin
readadc 4,Angle
PWout = PWin + Angle
pulsout 2,Angle
goto main
The abouve prog is to read the pot and output to a servo to move the barrek O.K.
-----------------------------------------------------------------------------------------
if i change to
main:
pulsin 3,1,PWin
readadc 4,Angle
PWout = PWin + Angle
pulsout 2,PWout
goto main
it all goes wrong
i need to do some maths but i will admit i dont know how PLEASE PLEASE Help
Regards Andy Quirot
Well i cant combine the two inputs i am no good at maths and need some help to do the maths PLEASE.
---------------------------------------------------------------------------------------
'Using a pot for gun barrel stiblision File Name Gun Gyro01
'PICAXE-08M connections are:
' Leg 1 +5V
' Leg 2 (Serial in) Tie to Ground through 10K resistor
' Leg 3 (In4/Out4) Wiper of 5K potentiometer connected to +5V and ground
' Leg 4 (In3) Pulse input from radio receiver
' Leg 5 (In2/Out2) Pulse output to servo
' Leg 7 (Out0/Serial Out) NC
' Leg 8 Ground
symbol Angle=b8 'Name the delay factor
symbol PWin=w0 'Name the input pulse length
symbol PWout=b2 'Name the output pulse length
main:
pulsin 3,1,PWin
readadc 4,Angle
PWout = PWin + Angle
pulsout 2,Angle
goto main
The abouve prog is to read the pot and output to a servo to move the barrek O.K.
-----------------------------------------------------------------------------------------
if i change to
main:
pulsin 3,1,PWin
readadc 4,Angle
PWout = PWin + Angle
pulsout 2,PWout
goto main
it all goes wrong
i need to do some maths but i will admit i dont know how PLEASE PLEASE Help
Regards Andy Quirot
Last edited: