Parsing data from pyserial
Grant Edwards
grante at visi.com
Sun Dec 3 13:44:07 EST 2006
On 2006-12-03, Si Ballenger <shb*NO*SPAM*@comporium.net> 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.
--
Grant Edwards grante Yow! NEWARK has been
at REZONED!! DES MOINES has
visi.com been REZONED!!
More information about the Python-list
mailing list