I need a little “nudge” in how to program my Maestro 12 servo controller.
My programming experience is all in either Basic or QuickBasic. I don’t think
either language lets me send commands via the USB port.
What I need written is a series of 12 .exe programs that move one of the servos from
neutral to 20 deg and back to neutral. ie, one of the 12 servos pulses.
Could you suggest which of c+ or vb.net would be best for me to learn? Or would the Maestro Control
Center software do what I need? Or is there something else I’m missing?
Why do you need 12 exe programs? It seems more natural to write a single exe that takes an argument on the command line that specifies what position to move the servo to. We have already created this. It is called UscCmd and it should be on your computer if you installed the Maestro Control Center. You should be able to invoke UscCmd directly from a Command Prompt, and you can make 12 batch scripts or 12 shortcuts that invoke UscCmd with the desired arguments.
Just run UscCmd at a Command Prompt to get a help screen.
Thanks, so I just need to learn to parse the arguments of usccmd.exe.
Are there any examples online I can learn from? It looks like I might need to generate a configuration file and then a script (scripts?) which takes an argument of servo number.
No, it’s way simpler than that. You don’t need to use every feature of UscCmd, you just need to use the one that is relevant to you, which is the “–servo” option.
Here’s an example you can learn from. Try typing these two commands at a Command Prompt and observe what they do to a servo attached to channel 0:
UscCmd --servo 0,6000
UscCmd --servo 0,7000
If you have configured the Maestro correctly (channel 0 is a Servo and the Serial Mode is not UART, detect baud rate) and connected the servo and your power supply correctly, then the commands above will send servo 0 to two different positions: 1500 us and 1750 us, respectively.
Wonderful (almost). That’s simple and it works. But it isn’t quite what I need.
I need to do the equivalent of
’usccmd --servo 0,7000’
followed immediately by
’usccmd --servo 0,6000’ .
The servo arm pushes a button, then has to return to neutral. I can’t schedule the two commands individually, because the granularity of the scheduler is one minute.
I was thinking incorporating a script would work, but it seems the script has to be already loaded to the device to “–start” it, so that wont work unless the script loading can be automated for each servo.
And why do the Maestro Control Center target numbers differ so much from those in usccmd, and also are reverse direction?
Thanks very much for your help, it’s much appreciated.
Try making a file named “maestro1.bat” with the following contents, and run it:
usccmd --servo 0,7000
ping -n 2 127.0.0.1
usccmd --servo 0,6000
If this were Linux, you could use “sleep 2” instead of the ping command. Windows doesn’t have a built-in command for sleeping, so people sometimes use ping for that purpose.