Controlling Micro Maestro and from Phyton with Raspbery PI

Hi, I’m struggeling getting a connection and setting server positions with my Micro Maestro USB controller . pololu.com/product/1350

I’m using Raspberry PI and phyton. Here is my script:

This is the first time I’m trying out phyton and linux. Any obvious mistakes?

Hello.

Since your code is very similar, it looks like you might have already seen this “RPi Android HTML5 Realtime Servo Control” example. If not, it might be helpful to read through. From doing an Internet search for [quote]TypeError: ‘str’ does not support the buffer interface[/quote] it sounds like it is a problem with running code written for Python 2 on Python 3. You might try either adapting the code or using Python 2.

-Brandon

Hi, YES!, you were right, using version 2.7 of python did solve it! I was using version 3.2
I’ll look more carefully into the changes of the string type, but at least i finally got it to work.
Thanks!!

Has anyone ported the setAngle function to Python 3 version yet? I’ve experienced so much trouble trying to convert the command char into bytes before sending it through to the serial write function. :unamused:

The bud line needs to be broken down as follows:

self.sc.write(b'\xff')
self.sc.write(bytes(char(n),'utf-8')
self.sc.write(bytes(char(byteone),'utf-8')

The servo will work well with any target positions between 0-90 degrees, as well as 180 degrees, but when I tried anything between 91 and 179 it would go erracticly or just wont respond at all.

Hello.

Please see my response here.

- Amanda