Hi, I’m currently trying to combine two programs for the Maestro 6 channel device. I need a push button to trigger one servo to do an action. Then I need a pot to affect a 2nd servo. Individually I can get both to work very well and when I try to combine the functionality into one program the pot works but not the push button. I’d like the push button to run servo to 2 portions.
Button and pot are wired as instructed in the manual. button has a 10k resister and the pot is a 10k as well.
this is my code.
begin
button_a if sequence_a endif
button_b if sequence_b endif
repeat
sub button_a
0 get_position 500 less_than
return
sub_wait_for_button_press
weit_for_button_open_10ms
wait_for_button_closed_10ms
return
sub wait_for_button_open_10ms
get_ms
begin
button_a
if
drop get_ms
else
get_ms over minus 10 greater_than
if drop return endif
endif
repeat
sub wait_for_button_closed_10ms
get_ms
begin
button_a
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat
sub button_b
1 get_position 500 less_than
return
sub sequence_a
4000 2 servo 1000 delay
7200 2 servo
return
sub sequence_b
4000 0 300 servo_range
6000 300 600 servo_range
8000 600 1023 servo_range
return
sub servo_range
pot 2 pick less_than logical_not
pot 2 pick greater_than logical_not
logical_and
If
begin
pot 2 pick 10 minus less_than logical_not
pot 2 pick 10 plus greater_than logical_not
logical_and
while
2 pick 3 servo
repeat
endif
drop drop drop
return
sub pot
1 get_position
return