Hi
I wonder if anyone can point me in the right direction on how to program the following for the 6 ch micro Maestro
I have two switches. One is a momentary push switch and the other is controlled by a transmitter using the RC digital sw. These are to control retracts and doors on a model plane. I can get the sequence to work fine if I just have one sw connected - either the momentary sw or the transmitter but I can’t figure out how to program to control the sub routines if either sw is activated. ie if the transmitter is off I can sequence the servos by pressing the sw or if the transmitter is on I can sequence by using the rc digital sw or the momentary sw. So far my attempts have resulted in either only one sw will control or I get stack overflows. I have used the sample sw program as a basis and modified that to my needs. If anyone can help it would be much appretiated
My script is below
1 4 acceleration
80 4 speed
2000 delay
geardown
goto main_loop
sub switch
0 get_position 500 less_than
return
# This subroutine uses the BUTTON subroutine above to wait for a button press,
# including a small delay to eliminate noise or bounces on the input.
sub wait_for_tx_toggle
wait_for_sw_rear_10ms
wait_for_sw_forward_10ms
return
# Wait for the button to be NOT pressed for at least 10 ms.
sub wait_for_sw_forward_10ms
get_ms # put the current time on the stack
begin
# reset the time on the stack if it is pressed
switch
if
drop get_ms
else
get_ms over minus 10 greater_than
gearup
if drop return endif
endif
repeat
return
# Wait for the button to be pressed for at least 10 ms.
sub wait_for_sw_rear_10ms
get_ms
begin
# reset the time on the stack if it is not pressed
switch
if
get_ms over minus 10 greater_than
geardown
if drop return endif
else
drop get_ms
endif
repeat
sub geardown
4000 4 servo #door open
moving_wait
3600 5 servo #retract down
led_on
return
sub gearup
8000 5 servo #retract up
2500 delay
8000 4 servo #door shut
led_off
return
sub moving_wait
begin
get_moving_state
while
repeat
return
main_loop:
begin
wait_for_tx_toggle
repeat
Thanks
Mark