im looking for help with LED script to add to my already working servo script.
I currently have 2 servo’s moving at the same time at the push of a button. I want to be able to push the button, servo’s go up and LED’s go off. Push button, servo’s go down… LED’s have slight delay then flicker then come on and stay on until button is pressed to go back to the start of the sequence.
here is my script so far, as used from the example on the main page… I just want to know what to add and where to add it.
im guessing its a sub routine but not sure…
goto main_loop # Run the main loop when the script starts (see below). # This subroutine returns 1 if the button is pressed, 0 otherwise. # To convert the input value (0-1023) to a digital value (0 or 1) representing # the state of the button, we make a comparison to an arbitrary threshold (500). # This subroutine puts a logical value of 1 or a 0 on the stack, depending # on whether the button is pressed or not. sub button 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_button_press wait_for_button_open_10ms wait_for_button_closed_10ms return # Wait for the button to be NOT pressed for at least 10 ms. sub wait_for_button_open_10ms get_ms # put the current time on the stack begin # reset the time on the stack if it is pressed button if drop get_ms else get_ms over minus 10 greater_than if drop return endif endif repeat # Wait for the button to be pressed for at least 10 ms. sub wait_for_button_closed_10ms get_ms begin # reset the time on the stack if it is not pressed button if get_ms over minus 10 greater_than if drop return endif else drop get_ms endif repeat # An example of how to use wait_for_button_press is shown below: # Uses WAIT_FOR_BUTTON_PRESS to allow a user to step through # a sequence of positions on servo 1. main_loop: begin 4000 4000 frame 6000 6000 frame repeat sub frame wait_for_button_press 2 servo 1 servo return