Parsing data from pyserial

John Machin sjmachin at lexicon.net
Sun Dec 3 20:33:59 EST 2006


Si Ballenger wrote:
>
> Per what was posted (below), it appears that the the appropriate
> data is being received.
[snip]
>
> 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']

Based on the split() results (presumably much more reliable than the
"print reading" results)  what appears to me is:
fragment                         '59', '123', '87', '25'
packet 'M', '37', '79', '3', '4', '59', '124', '86', '25'
fragment 'M',  '39' [see note]
fragment                                         '85', '26'
packet 'M', '38', '77', '3', '2', '59', '124', '86', '25',
fragment 'M', '38'

[note] the 39 obviously aligns with the 37 and 38s, not with the 123
and 124s. However the boundary of the 2 split() results lies before the
39, not after. Puzzling.

In any case, I wouldn't call that "the appropriate data is being
received" -- looks like chunks missing to me.




More information about the Python-list mailing list