I have spent many hours looking over your script examples and searching your forum for what i think is a simple task.
I am using a relay switch and your micro maestro 6 to actuate 2 servos. I have been able to move the servos to a new position with each closed switch command. What I would like to have happen is for the servos to move to a position when closed and return when open. The following is a script example I am attempting to edit for my purpose.
Thank you in advance for the help.
# Uses WAIT_FOR_BUTTON_PRESS to allow a user to step through a sequence # of positions on servo 4,5 begin wait_for_button_press 8000 4 servo 500 delay 8000 5 servo 500 delay Wait_for_button_press 500 4 servo 500 delay 500 5 servo 500 delay repeat # Returns 1 if the button is pressed, 0 otherwise. sub button 0 get_position 500 less_than return # Waits for a button press, with debouncing. # (Requires the BUTTON subroutine.) 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 pressed button if get_ms over minus 10 greater_than if drop return endif else drop get_ms endif repeat