|
1 | 1 |
|
2 | | -[](https://github.com/marketplace/actions/arduino_ci) |
3 | | -[](https://github.com/RobTillaart/SHT31/actions/workflows/jsoncheck.yml) |
| 2 | +[](https://github.com/marketplace/actions/arduino_ci) |
4 | 3 | [](https://github.com/RobTillaart/SHT31/actions/workflows/arduino-lint.yml) |
| 4 | +[](https://github.com/RobTillaart/SHT31/actions/workflows/jsoncheck.yml) |
| 5 | +[](https://github.com/RobTillaart/SHT31/issues) |
| 6 | + |
5 | 7 | [](https://github.com/RobTillaart/SHT31/blob/master/LICENSE) |
6 | 8 | [](https://github.com/RobTillaart/SHT31/releases) |
| 9 | +[](https://registry.platformio.org/libraries/robtillaart/SHT31) |
7 | 10 |
|
8 | 11 |
|
9 | 12 | # SHT31 |
@@ -31,20 +34,27 @@ Accuracy table |
31 | 34 |
|
32 | 35 |
|
33 | 36 | An elaborated library for the SHT31 sensor can be found here |
34 | | -https://github.com/hawesg/SHT31D_Particle_Photon_ClosedCube |
| 37 | +- https://github.com/hawesg/SHT31D_Particle_Photon_ClosedCube |
| 38 | + |
| 39 | +A derived class for using the SHT31 sensor with SoftWire (soft I2C) can be found here |
| 40 | +- https://github.com/RobTillaart/SHT31_SW |
35 | 41 |
|
36 | 42 |
|
37 | 43 | ## Interface |
38 | 44 |
|
| 45 | +```cpp |
| 46 | +#include "SHT31.h" |
| 47 | +``` |
| 48 | + |
| 49 | + |
39 | 50 | #### Base interface |
40 | 51 |
|
41 | | -- **SHT31()** constructor. |
| 52 | +- **SHT31(TwoWire \*wire = &Wire)** constructor. Optional select the I2C bus (Wire, Wire1 etc). |
42 | 53 | - **bool begin(uint8_t address, uint8_t dataPin, uint8_t clockPin)** begin function for ESP8266 & ESP32; |
43 | 54 | returns false if device address is incorrect or device cannot be reset. |
44 | 55 | - **bool begin(uint8_t dataPin, uint8_t clockPin)** same as above. With default SHT_DEFAULT_ADDRESS. |
45 | | -- **bool begin(uint8_t address, TwoWire \*wire = &Wire)** for platforms with multiple I2C buses. |
46 | | -- **bool begin(TwoWire \*wire = &Wire)** same as above. |
47 | | -With default SHT_DEFAULT_ADDRESS. |
| 56 | +- **bool begin(uint8_t address = SHT_DEFAULT_ADDRESS)** |
| 57 | +Returns false if device address is incorrect or device cannot be reset. |
48 | 58 | - **bool read(bool fast = true)** blocks 4 (fast) or 15 (slow) milliseconds + actual read + math. |
49 | 59 | Does read both the temperature and humidity. |
50 | 60 | - **bool isConnected()** check sensor is reachable over I2C. Returns false if not connected. |
@@ -149,7 +159,29 @@ See examples. |
149 | 159 |
|
150 | 160 | ## Future |
151 | 161 |
|
152 | | -- keep in sync with SHT85 library |
153 | | -- check TODO in code |
| 162 | +#### Must |
| 163 | + |
| 164 | +- keep in sync with SHT85 library. |
| 165 | +- keep derived SHT31_SW builds green |
| 166 | + |
| 167 | +#### Should |
| 168 | + |
| 169 | +- check TODO in code. |
| 170 | +- rename MAGIC numbers. e.g. in dataReady() |
| 171 | + |
| 172 | +#### Could |
| 173 | + |
| 174 | +- move code from .h to .cpp |
| 175 | + |
| 176 | +#### Wont |
| 177 | + |
| 178 | + |
| 179 | +## Support |
| 180 | + |
| 181 | +If you appreciate my libraries, you can support the development and maintenance. |
| 182 | +Improve the quality of the libraries by providing issues and Pull Requests, or |
| 183 | +donate through PayPal or GitHub sponsors. |
| 184 | + |
| 185 | +Thank you, |
154 | 186 |
|
155 | 187 |
|
0 commit comments