I am trying to port a python program to an arduino and I strugle to create a network packet. This packet is constructed by struct.pack python routine.
The packet is constructed with this struct.pack argument : !BBHIII16s
Do you know how to build such binary format ?
remember your arduino is little endian so the unsigned short (uint16_t) and unsigned int (uint32_t) will likely need tweaking (permuting bytes) -> read the incoming 32 bytes in a byte buffer, then (counting from 0) flip bytes 2 and 3, and reverse 4 to 7, 8 to 11 and 12 to 15 so that they are in the right little endian mode. Then you can memcpy() the buffer into your struct and all should be aligned (with gcc)