is there a problem on this simple code
Peter Hansen
peter at engcorp.com
Sun Mar 13 10:50:03 EST 2005
Dennis Lee Bieber wrote:
>>rx_data1=0
>>while (rx_data1 != 0x46):
>> rx_data1 = ser.read(1)
>> (rx_command) = unpack('1B', rx_data1)
>
> Isn't this unpack rather redundant -- assuming ser.read(1) only
> reads one byte, then rx_data1 and rx_command would be identical.
Brain fart... unpack converts the raw bytes to integer
values with the "B" format character. You're thinking
of what would happen with a "1c" format.
-Peter
More information about the Python-list
mailing list