You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**begin(address, dataPin, clockPin)** begin function for ESP8266 & ESP32;
39
+
-**SHT31()** constructor.
40
+
-**bool begin(address, dataPin, clockPin)** begin function for ESP8266 & ESP32;
36
41
returns false if device address is incorrect or device cannot be reset.
37
-
-**begin(address)** for single I2C bus platforms, e.g UNO.
38
-
-**begin(address, TwoWire \*wire)** for platforms with multiple I2C busses.
39
-
-**read(bool fast = true)** blocks 4 (fast) or 15 (slow) milliseconds + actual read + math
40
-
-**isConnected()** check sensor is reachable over I2C. Returns false if not connected.
41
-
-**uint16_t readStatus()** details see datasheet and **Status fields** below
42
+
-**bool begin(address)** for single I2C bus platforms, e.g UNO.
43
+
-**bool begin(address, TwoWire \*wire)** for platforms with multiple I2C busses.
44
+
-**bool read(bool fast = true)** blocks 4 (fast) or 15 (slow) milliseconds + actual read + math.
45
+
Does read both the temperature and humidity.
46
+
-**bool isConnected()** check sensor is reachable over I2C. Returns false if not connected.
47
+
-**uint16_t readStatus()** details see datasheet and **Status fields** below.
42
48
-**uint32_t lastRead()** in milliSeconds since start of program.
43
-
-**reset(bool hard = false)** resets the sensor, soft reset by default. Returns false if fails.
44
-
-**getHumidity()** computes the relative humidity in % based off the latest raw reading, and returns it
45
-
-**getTemperature()** computes the temperature in °C based off the latest raw reading, and returns it
46
-
-**getRawHumidity()** returns the raw two-byte representation of humidity directly from the sensor
47
-
-**getRawTemperature()** returns the raw two-byte representation of temperature directly from the sensor
49
+
-**bool reset(bool hard = false)** resets the sensor, soft reset by default. Returns false if fails.
50
+
-**float getHumidity()** computes the relative humidity in % based off the latest raw reading, and returns it.
51
+
-**float getTemperature()** computes the temperature in °C based off the latest raw reading, and returns it.
52
+
-**uint16_t getRawHumidity()** returns the raw two-byte representation of humidity directly from the sensor.
53
+
-**uint16_t getRawTemperature()** returns the raw two-byte representation of temperature directly from the sensor.
48
54
49
55
Note that the temperature and humidity values are recalculated on every call to getHumidity() and getTemperature(). If you're worried about the extra cycles, you should make sure to cache these values or only request them after you've performed a new reading.
50
56
51
57
52
58
#### Error interface
53
59
54
-
-**getError()** returns last set error flag and clear it.
60
+
-**int getError()** returns last set error flag and clear it.
55
61
Be sure to clear the error flag by calling **getError()** before calling any command as the error flag could be from a previous command.
56
62
57
-
| Error | Symbolic | Description |
58
-
|:----:|:----|:----|
59
-
| 0x00 | SHT31_OK | no error |
60
-
| 0x81 | SHT31_ERR_WRITECMD | I2C write failed |
61
-
| 0x82 | SHT31_ERR_READBYTES | I2C read failed |
62
-
| 0x83 | SHT31_ERR_HEATER_OFF | Could not switch off heater |
63
-
| 0x84 | SHT31_ERR_NOT_CONNECT | Could not connect |
64
-
| 0x85 | SHT31_ERR_CRC_TEMP | CRC error in temperature |
65
-
| 0x86 | SHT31_ERR_CRC_HUM | CRC error in humidity |
66
-
| 0x87 | SHT31_ERR_CRC_STATUS | CRC error in statusfield |
0 commit comments