1

Hi I'm using Brian Wendt's code for setting up my Arduino Nano with 4 servos using PySerial which works perfectly.

So my next step was to get a nice GUI with sliders to position the servos, again no problems.

This issue is when I try to set an initial state for the servos. Servos 1 & 2 go to 0 degrees on start up but servos 3 & 4 go to 90 degrees for some reason?

My Python code for initialization,

import serial

usbport = 'COM5'
ser = serial.Serial(usbport, 9600, timeout=1)

def init():
    for servo in range(1, 5):
        print servo
        ser.write(chr(255))
        ser.write(chr(servo))
        ser.write(chr(0))

init()

Any takers?

2
  • Welcome to Arduino SE! First of all, this seems like a Python issue, not an Arduino issue. Does it work in serial monitor? Also, please add the relevant Arduino code to the question. Thanks! – Anonymous Penguin Mar 8 '15 at 14:42
  • Hi, I figured it our eventually, there was 2 conflicting initializations happening, one on the board one on the PC – DrBwts Mar 8 '15 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.