Untitled
unknown
plain_text
a year ago
408 B
3
Indexable
Never
uint32_t raw_humidity = ((uint32_t)ReadBuffer[1] << 12) | ((uint32_t)ReadBuffer[2] << 4) | ((uint32_t)ReadBuffer[3] >> 4); uint32_t raw_temperature = ((uint32_t)(ReadBuffer[3] & 0x0F) << 16) | ((uint32_t)ReadBuffer[4] << 8) | ReadBuffer[5]; *hum = (float)raw_humidity / (1 << 20) * 100; *temp = ((float)(raw_temperature & 0x7FFFFF) / (1 << 20)) * 200 - 50 ;//-3 for calibration purpose