Home > Net >  C # PC how to set two byte data type joining together into a short data
C # PC how to set two byte data type joining together into a short data

Time:04-11

Using c # MPU6050 PC by stm32 receiving sensor data:
Sensors are short type data, stm32 will split into two short type data uint8 data transmission
PC with byte type variable receiving, could you tell me how to after receiving two byte data splicing into short and right,

CodePudding user response:

Byte [] bytes=new byte [2] {0 x31, 0 x32};
Short under-16=(((short) bytes [0] <8) + bytes [1]);
  •  Tags:  
  • C#
  • Related