Combine / merge two bytes into one ...?

I work with sequential frames. I get a 16-bit value as two separate 8-bit values. How can I combine buffer [0] with buffer [1]? I don't want 0b01 + 0b10 = 12 (base 10). I want it to be 258.

How can i do this?

+4
source share
1 answer
uint16_t value = (highByte << 8) | lowByte ; 
+16
source

All Articles