All,
I am looking at creating a lightweight IR based Remote control for indoor flying Planes of about 10 to 15 gms. The code below is my first thoughts but it seems to easy ;-)
Has any one got any advise as to it's viability?
The TX will read in via READADC the voltage from the three pots that will then control the length of the channel pulses. The start of the control frame is marked by a 1.5 mS pulse. As there are three channels I then have three control pulses.
TX Code
The RX currently outputs to Servos but I will be changing this to actuators once I have this working.
Thanks for your time.
Cheers Jim
I am looking at creating a lightweight IR based Remote control for indoor flying Planes of about 10 to 15 gms. The code below is my first thoughts but it seems to easy ;-)
Has any one got any advise as to it's viability?
The TX will read in via READADC the voltage from the three pots that will then control the length of the channel pulses. The start of the control frame is marked by a 1.5 mS pulse. As there are three channels I then have three control pulses.
TX Code
Code:
;
; 08M2 Infrared TX
; 3 channel rudder and elevator on joystick and throttle on linear slide pot
;
init:
;
Do
readadc c.1,b0
w3=b0*57+7500/100
b0=b4
readadc c.2,b1
w3=b1*57+7500/100 ; this converts from the ADC range of 0 to 255 to PMM range of 75 to 220
b1=b4
readadc c.3,b2
w3=b2*57+7500/100
b2=b4
pulsout c.1,150
pause 5
pulsout c.1,b0
pause 5
pulsout c.1,b1
pause 5
pulsout c.1,b2
pause 10
Loop
Code:
;
; 08M2 Infrared RX
; 3 servo channels for rudder, elevator and throttle for external
;
init:
servo c.1,75 ; Initialise throttle servo
servo c.2,75 ; Initialise elevator servo
servo c.3,75 ; Initialise rudder servo
do
pulsin c.4,1,w1 ; detect the start frame pulse of 1.5mS
if w1 = 150 then
for b0 = 1 to 3
pulsin c.4,1,w1 ; detect the channel pulses between 7.5mS and 22.5mS for each channel
w1 = w1 / 100
If b2 >= 75 and b2 <= 225 and b0 = 1 then servopos c.1,b2 ;b2 is low byte of w1
If b2 >= 75 and b2 <= 225 and b0 = 2 then servopos c.2,b2
If b2 >= 75 and b2 <= 225 and b0 = 3 then servopos c.3,b2
next b0
endif
loop
Cheers Jim