Looking at your recent script, you have a begin/repeat block within your
Sequence_0 subroutine, which is causing the program to repeat. One way to fix this problem is to remove the begin/repeat lines in
Sequence_0 and use
return instead (at the end of that subroutine). Then add begin/repeat lines around the code under
main_loop. Like so:
# Sequence 0
500 5940 0 0 5800 0 frame_1..5 # Frame 0
1300 6400 6400 frame_1_4 # Frame 1
1300 delay # Frame 2
1300 delay # Frame 3
1300 delay # Frame 4
1300 delay # Frame 5
1300 delay # Frame 6
1300 delay # Frame 7
1300 5940 5800 frame_1_4 # Frame 8
return at the end of the
Sequence_0 subroutine tells the program to return back to the point where the subroutine was last called, which prevents the program from falling through and executing
frame_1..5. By encapsulating
Sequence_0 in a begin/repeat block under
main_loop, the program will continually cycle between waiting for a button press (lasting for at least 3 seconds) and executing the movement sequence.
Since it seems that you are new to using the Maestro Scripting Language, I strongly recommend reading the "Command Reference" section of the Maestro Servo Controller User's Guide to get a better understanding of the commands.
By the way, you mentioned in your previous post that the last bit of code actually controls an LED output that you assigned to servo 4, but in your original script, it does not look like the program will ever reach that section of code. If you can tell me what you are using the LED for, I might be able to offer suggestions on how you can implement that feature into your script.