Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Reading analog input from Maestro channel to MATLAB

Hi David,

I was able to write to Maestro 6 Servo Controller using MATLAB. but any idea how can I read anlog input from one of its channels to Matlab? any sample code to do that? I cant read analog input from a specific channel


I split your question into its own thread because the other thread was not about reading analog inputs. To read an analog input value from the Maestro using MATLAB, you will first need to configure a channel of the Maestro to be an input using “Channel Settings” tab in the Maestro Control Center. You should also set the Maestro’s serial mode to “USB Dual Port” so it can accept serial commands over its USB connection. Be sure the click “Apply Settings” and leave the Maestro connected to your computer via USB.

Then you’ll need to write a MATLAB program that opens the Maestro’s Command Port, sends a “Get Position” command for the appropriate channel, and reads the response back. The other thread has some code you can reuse, but you will need to change the bytes that are being sent to the Maestro and you will need to add code that waits for the Maestro to respond and reads the two bytes of its response. For details about the “Get Position” command, see the “Serial Servo Commands” section of the Maestro User’s Guide.

If you continue to have trouble, please post your code and a description of the results you are getting, and I’d be happy to take a look.