How can i send 8-bit data or binary data with pyserial?
Scott David Daniels
Scott.Daniels at Acm.Org
Wed Dec 15 17:24:26 EST 2004
Fredrik Lundh wrote:
> "ouz as" <oguz_aylanc at hotmail.com> wrote:
>>i have an electronic module which only understand binary data.
>>i use python pyserial.
>>for example the module starts when 001000000 8-bit binary data sent.but
>
> ... in computers, bits are combined into bytes (or longer machine words).
> the strings you pass to pyserial are treated as byte sequences....
Just one other bit (byte?) of data that wasn't mentioned here:
the array module also provides handy conversions.
array.array('B', [1,2,3,4]).tostring() == '\1\2\3\4'
This may prove useful as you create message packets.
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list