I have a microcontroller connected to my computer via I2C connection, which sends back 1 byte of data at a time. I am trying to send a 4-byte number to the python program. I receive it in an array of individual bytes like this [123,45,67,89].
I need to convert that back into an integer in python. I am trying to use struct.unpack to do this, but I cannot get the data format correct. I am trying to get it in the form:
struct.unpack("I",b'x12\x34\x56\x78)
I don't know how to get the 4 bytes into the form required by struct. I can convert the numbers to hex, but don't know how to string them together.