pySerial Vs 2 Serial Ports

Virgílio Bento virbento at gmail.com
Wed Nov 17 17:20:34 CET 2010


Dear all,

I Have two modules communicating by Bluetooth. Basically I want to rotate
two vector using the accelerometer data.
I read the data using pyserial like this:

###############################################
ser1 = serial.Serial(port='COM6',baudrate=19200)
if ser1.isOpen():
    print "Comm 1 is open"

ser2 = serial.Serial(port='COM43',baudrate=19200)
if ser2.isOpen():
    print "Comm 2 is open"
###############################################

And then retirieve the raw data in a while loop like this:

while True:
   line1 = ser2.readline()
   line2 = ser1.readline()
...

My problem is the following... when I read from only one module, all goes
smooth, but when i try to read from the two modules, the second one that i
read retrieves the data with a huge delay.
In terms of debug, I tried to run two independent scripts, each one opening
and retrieving data from one COM port and there isn't any delay, only when i
read the two COM's in the same script i get the delay.

Any Clue?

Thanks in Advance.

Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101117/55bb25b4/attachment.html>


More information about the Python-list mailing list