Halloween help

hello have the code below and wish to just add ch 4 & 5 with leds. I would love for ch4 to stay on thru button presses and ch5 to come on when open and off when closed. is this doable? Would take my halloween to another level thank you for any help. :

goto main_loop

sub button 
0 get_position 500 less_than
return

sub wait_for_button_press 
wait_for_button_open_10ms 
wait_for_button_closed_10ms 
return

sub wait_for_button_open_10ms 
get_ms
begin
button 
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 
if
get_ms over minus 10 greater_than
if drop return endif
else
drop get_ms
endif
repeat

main_loop:
begin
2250 9000 frame 
9000 2250 frame 
repeat

sub frame 
wait_for_button_press 
1 servo 2 servo 

return

Helllo.

If I understand you correctly, you want the following correspondence:
button closed => channel 4 LED on, channel 5 LED off
button open => channel 4 LED off, channel 5 LED on

First of all, you should follow the instructions in the “LED” subsection of the “Attaching Servos and Peripherals” section of the Maestro user’s guide. Then you could probably just modify your “wait_for_button_press” code like this:

sub wait_for_button_press
  8000 4 servo  # LED4 on
  4000 5 servo  # LED5 off
  wait_for_button_open_10ms
  4000 4 servo  # LED4 off
  8000 5 servo  # LED5 on
  wait_for_button_closed_10ms 
  return

The final step is to take a video of your project in action, and write a tutorial here about how you made it!

–David