Python program for mini maestro driving 2-axis servo gimbal

I’m building a 2-axis servo gimbal based on the mini maestro 12. I have it working using the Control Center, and have been able to use scripts to move the gimbal thru specific paths. Next step is to use Python to program the servos to move, and I’m new to this, so I need some help.

I have installed Python 3.5.2 on a Win10 PC, installed and pyserial,py in the module library. There are some issues with because when I import it there is an error message about invalid syntax on line 131.

Assuming I can get this resolved, I don’t know how to begin the programming. I have seen snippets of code on the forums, but still need to know how to set up the the entire program to operate the servos. I’d be happy to just see them move in response to a short program.

Can you help with ideas/resources to get me rolling?


Hello, Joe.

We did not write and do not have any Python example code for the Maestro. If you have not done so already, you should read the README file on the GitHub page (near the bottom). The README contains a code usage example and discusses how the Maestro needs to be configured in order to work with the Python class. I also suggest looking at the source code, which is well documented, in conjunction with the Pololu Maestro Servo Controller User’s Guide, particularly the “Serial Interface” section of the guide, to better understand how to control the Maestro using Python. If you are not familiar with the Python language, I strongly recommend going through the Python documentation before continuing.

With regards to the error message you are getting, can you post your entire Python script?

- Amanda