On Sun, 03 Dec 2006 18:44:07 -0000, Grant Edwards <[EMAIL PROTECTED]> wrote:
>On 2006-12-03, Si Ballenger <[EMAIL PROTECTED]> wrote: > >>>> 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. >>> >>>I doubt that's the issue. He's reading with a 1-second timeout >>>value. >> >> I would think a time delay would be needed between the below two >> lines in the code if he expects to get a useable data string back >> from the gizmo for the command sent to it. >> >> ser.write("TC 016 240 100 240 016 240\r\n") >> reading = ser.read(40) > >No. A delay isn't needed as long as the device responds within >1 second. The read() call will wait up to 1 second for the >first byte of the response. Per what was posted (below), it appears that the the appropriate data is being received. It may be possible that the cam may be sending in a mode that is not in alignment with the binary transmission mode of the serial port. As a test I'd jumper between the Tx and Rx pin on the serial port and then send out the "M" line being received, then see if it will parse as expected. Here is an example output: M 37 79 3 4 59 124 86 25 ['59', '123', '87', '25', 'M', '37', '79', '3', '4', '59', '124', '86', '25', 'M '] M 38 77 3 2 59 124 86 25 ['39', '85', '26', 'M', '38', '77', '3', '2', '59', '124', '86', '25', 'M', '38' , '7'] -- http://mail.python.org/mailman/listinfo/python-list