So i have struct:
typedef struct sendPacketStruct {
byte header = headerByte;//0x55
unsigned int time;//2 bytes
int height;//2 bytes
};
And i do this:
sendPacketStruct sendPacket;
sendPacket.time = 84;//0x54
sendPacket.height = 100;//0x65
Serial.write((byte*)&sendPacket, sizeof(sendPacket));
But when i receive it at the other end the hex bytes are:
55 54 00 64 00
So the first byte is correct as the header 0x55, but the 2x 2 byte values time and height are there but shifted.
eg it should be 00 54 not 54 00
it should be 00 54 not 54 00... why? ... is it causing a problem? ... the bytes are not shifted