HI, All
AHT21 sensor (humidity and temperature) returns 5 bytes of data (among 7):
Some C-code of the lib to convert is:
How to make this in B4R ?
Bit.operations are only for 16-bit UInt, how to merge these 2.5 bytes to ULong 32-bit variables ?
AHT21 sensor (humidity and temperature) returns 5 bytes of data (among 7):
Some C-code of the lib to convert is:
B4X:uint32_t humidity = _rawData[1]; //20-bit raw humidity data humidity <<= 8; humidity |= _rawData[2]; humidity <<= 4; humidity |= _rawData[3] >> 4; uint32_t temperature = _rawData[3] & 0x0F; //20-bit raw temperature data temperature <<= 8; temperature |= _rawData[4]; temperature <<= 8; temperature |= _rawData[5];
How to make this in B4R ?
Bit.operations are only for 16-bit UInt, how to merge these 2.5 bytes to ULong 32-bit variables ?
Last edited: