Re: Parsing data from pyserial
- From: shb*NO*SPAM*@comporium.net (Si Ballenger)
- Date: Mon, 04 Dec 2006 01:13:25 GMT
On Sun, 03 Dec 2006 18:44:07 -0000, Grant Edwards
<grante@xxxxxxxx> wrote:
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.
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']
.
- Follow-Ups:
- Re: Parsing data from pyserial
- From: John Machin
- Re: Parsing data from pyserial
- References:
- Parsing data from pyserial
- From: Lone Wolf
- Re: Parsing data from pyserial
- From: Si Ballenger
- Re: Parsing data from pyserial
- From: Grant Edwards
- Re: Parsing data from pyserial
- From: Si Ballenger
- Re: Parsing data from pyserial
- From: Grant Edwards
- Parsing data from pyserial
- Prev by Date: Re: Why not just show the out-of-range index?
- Next by Date: Re: How to realize the interactive python in Eclipse?
- Previous by thread: Re: Parsing data from pyserial
- Next by thread: Re: Parsing data from pyserial
- Index(es):
Relevant Pages
|