On Sat, 2 Dec 2006 23:02:06 -0500, Lone Wolf <[EMAIL PROTECTED]> wrote:
>I'm trying to get data through my serial port from a CMUcam. >This gizmo tracks a color and returns a packet of data. The >packet has nine data points (well, really eight since the first >point is just a packet header) separated by spaces as follows: M >xxx xxx xxx xxx xxx xxx xxx xxx > >Here is the code I am using (python v24): > >import serial > >ser=serial.Serial('com1',baudrate=115200, bytesize=8, >parity='N', stopbits=1,xonxoff=0, timeout=1) > >ser.write("PM 1") #This sets the CMUcam to poll mode > >for i in range(0,100,1): > ser.write("TC 016 240 100 240 016 240\r\n") > reading = ser.read(40) > print reading > components = reading.split() > print components >ser.close In my dealing with serial gizmos I have to put a delay between the request sent to the gizmo and the reading of the serial input buffer for returned data. Serial ports and gizmos need some time to do their thing. -- http://mail.python.org/mailman/listinfo/python-list