I’ve never done any scripting before and finding it to be a steep learning curve. I did look through this forum and found someone who was looking to write a script for a servo to move at two different speeds. I think I managed to decipher what was going on and wrote this:
# Sequence 0
500 delay #So this represents the delay before first move?
0 2 speed # 0 speed ie fastest speed for servo 2
10000 2 servo # move servo 2 to 10000
700 delay # delay after first move
50 2 speed # speed setting much slower for second move on servo 2
5000 2 servo # move servo 2 to 5000
700 delay #delay after second move
repeat #cycle through previous commands
Does this seem right? The two servo positions (10000 and 5000) do not correspond to my servo settings though. When I test my servos on the slider, they come as 992, 1500 (middle) and 2000. Is a different unit of measurement used when writing script?
If anyone has any resources for me to read I would be grateful. The maestro instructions on script go over my head… I need to start at the start!
It sounds like you have the general understanding of what that script does. The Maestro scripting language uses target values in units of quarter-microseconds, while the “Target” values shown in the “Status” tab of the Maestro Control Center are in units of microseconds. So when the code you posted sets the target of servo 2 to 10000 quarter-microseconds, it corresponds to a target value of 2500 microseconds. However, if you tried to run this script with a Maestro using default settings, you would probably notice servo 2 goes to 2000 microseconds instead of 2500; this is because the default “Max” limit for channel 2 is set to 2000. The “Min” and “Max” limits for each channel can be changed in the “Channel Settings” tab of the Maestro Control Center, but please note that sending pulses outside of the normal 1-2ms range for standard hobby RC servos could damage your servo if the pulses are beyond the acceptable range for your servo.
By the way, the Maestro scripting language is very similar to a stack-based programming language called Forth, so you might find resources pertaining to Forth useful. Also, “The Maestro Scripting Language” section of the Maestro user’s guide has several examples that you can walk through and try for yourself. The Maestro Control Center has a button labeled “Step Script” in the “Script” tab that can be used to step through your script one line at a time. From my experience, this is a great tool to start with since it lets you slow everything down and see the affect of each line of code.