Notifications
Clear all
Topic starter
2019-12-18 1:24 pm
Here's a bit of info on struct packing,
After reading the article, I changed the sketch again to:
typedef struct{ float afloat = 15.4; uint8_t abyte = 12; uint8_t bbyte = 5; }data; data myData;
and the Python code to:
while True:
data = ser.read(6)
#struct.unpack(format, bytestring)
tup = struct.unpack('fcc', data)
print(data)
print(tup)
ser.close()
And got the following aligned output:
(15.399999618530273, b'\x0c', b'\x05')
b'ffvA\x0c\x05'
(15.399999618530273, b'\x0c', b'\x05')
b'ffvA\x0c\x05'
I guess I can get back to my pre-Xmas stress now ?
Page 7 / 7
Prev