2016-05-14 12:08 PM
Hello,
i tried to connect my STM32F103 to a HTS221 sensor, but I do not get correct values for temperature and humidity. HTS221_Driver.c has version 1.0.0 from 07/04/2014 What I did so far:
...
HTS221_Set_PowerDownMode(HTS221_SET); // Tried with HTS221_RESET as well
... // Do other stuff for ~10ms
uint8_t deviceId;
HTS221_Get_DeviceID(&deviceId); // successfully returns 0xbc
HTS221_StartOneShotMeasurement();
HTS221_BitStatus_et humidityStatus = HTS221_RESET, temperatureStatus = HTS221_RESET;
while (temperatureStatus == HTS221_RESET) {
HTS221_Get_DataStatus(&humidityStatus, &temperatureStatus);
}
HTS221_Get_Temperature(&tempTemperature);
while (humidityStatus == HTS221_RESET) {
HTS221_Get_DataStatus(&humidityStatus, &temperatureStatus);
}
HTS221_Get_Humidity(&tempHumidity);
HTS221_DeActivate();
humidity = ((float) tempHumidity / 10); // Result is 100%
temperature = ((float) tempTemperature / 10); // Result is 127°C
Did I missed anything?
Please help me, I checked a lot of code samples but most of them deal with I2C only.
Thx in advance!
Alexander
#hts221 #stm32f10x
2016-05-16 01:14 AM