[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pythonmac-sig
Subject:    [Pythonmac-SIG] pyserial. am I using it wrong?
From:       adam naples <adam.naples () yale ! edu>
Date:       2006-11-22 19:49:49
Message-ID: 7C1E9EE1-91F6-456D-BC2C-3D2103ACEDDB () yale ! edu
[Download RAW message or body]

Hi, I'm running Tiger with a keyspan usb to serial adapter.
I'm trying to get python to communicate with an eye-tracker that  
continually spits out coordinates
everything seems fine when I import the module, but it seems like it  
only reads in the first 1020 lines of data when create a new serial  
object and then stops listening to the serial port. When I use  
flushInput() it empties the buffer, but then nothing comes back into  
it, and I can verify that the eye-tracker is still sending.

the code is pretty much like this
 >>>import serial
#make a serial object
 >>>ser = serial.Serial('/dev/tty.KeySerial1', 19200, timeout=1)
 >>> x = ser.readline()
 >>> x
'\x82J\x00 263.0\t\r\n'

#now when I flush the input, because I want the up-to-date coordinates
#it empties the buffer
 >>> ser.flushInput()
 >>>ser.inWaiting()
0L
 >>>ser.readline()
''
#I would expect that it would flush the input buffer and let me get  
at the most current set of coordinates, but instead I get nothing

is something  wrong with pyserial? am I using it wrong? if I use  
director(ugh) it reads the serial data just fine, and continually.
any help would be great.
thanks
-an
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic