Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By schufti
#37861 obviously the sensor isn't found.

This could be due to
a) wrong pins used (NodeMCU has different notation)
GPIO0 --> D3 GPIO2 --> D4
b) bad i2c implementation
there were issues with AM2321 too, see here:
viewtopic.php?f=32&t=4483&p=26342#p26342
c) other problems e.g. i2c speed, try i2c-scanner
User avatar
By Kaz260
#43915 You should use "No hold mode". I think it will work fine.

CODE:
typedef enum {
eTempNoHoldCmd = 0xF3,
eRHumidityNoHoldCmd = 0xF5,
} HUM_MEASUREMENT_CMD_T;

float SHT2xClass::GetTemperature(void){
float value = readSensor(eTempNoHoldCmd);
...
}

float SHT21xClass::GetHumidity(void) {
float value = readSensor(eRHeRHumidityNoHoldCmd);
...
}