On 05/31/2016 06:20 PM, jlada...@itu.edu wrote: > So, how can I take the byte sequence <0x01 0x02 0x03 0x04 0x05 0x06 > \n> that Serial.readline() returns to me, and QUICKLY turn it into > three integer values, 258, 772, and 1286? Better yet, can I write > these bytes directly into an array (numpy is an option), since I'm > going to have a lot of them?
I think you might want to use the struct module. It's designed for this kind of packing and unpacking: https://docs.python.org/3/library/struct.html > I never thought I would find a task that's easier for me to imagine > doing in C than in Python, but at the moment this is one. Thanks for > any suggestions! Byte and bit twiddling are things that C has always been fast at. But I think Python probably could do it. -- https://mail.python.org/mailman/listinfo/python-list