Skip to main content
1 of 2
Majenko
  • 105.9k
  • 5
  • 82
  • 139

If they were in the same endian order as a long (little-endian on an Arduino, which they don't appear to be) you could just point to them:

uint32_t *l = (uint32_t *)&packetBuffer[40];

Then use *l to access the content as a long.

However since they look to be in a big-endian order it's not that simple. The simplest thing you can do is just re-combine them with bit-shifting:

uint32_t l = (packetBuffer[40] << 24) | (packetBuffer[41] << 16) | 
             (packetBuffer[42] << 8) | packetBuffer[43];
Majenko
  • 105.9k
  • 5
  • 82
  • 139