File tree Expand file tree Collapse file tree 14 files changed +51
-9
lines changed
Expand file tree Collapse file tree 14 files changed +51
-9
lines changed Original file line number Diff line number Diff line change 88
99Arduino library for the SHT31 temperature and humidity sensor
1010
11+
1112## Description
1213
1314The SHT3x family of sensors should work up to 1 MHz I2C
@@ -25,6 +26,7 @@ not tested yet.
2526An elaborated library for the SHT31 sensor can be found here
2627https://github.com/hawesg/SHT31D_Particle_Photon_ClosedCube
2728
29+
2830## Interface
2931
3032#### Base interface
@@ -42,6 +44,7 @@ returns false if device address is incorrect or device cannot be reset.
4244- ** getHumidity()** returns relative humidity in %
4345- ** getTemperature()** returns temperature in °C
4446
47+
4548#### Error interface
4649
4750- ** getError()** returns last set error flag and clear it.
@@ -59,7 +62,6 @@ Be sure to clear the error flag by calling **getError()** before calling any com
5962| 0x87 | SHT31_ERR_CRC_STATUS | CRC error in statusfield |
6063
6164
62-
6365#### Heater interface
6466
6567Use the heater for max ** 180** seconds, and let it cool down an equal period of time.
@@ -77,6 +79,7 @@ This value is truncated to max 180 seconds.
7779Will switch heat off if max heating time has passed.
7880- ** heatUp()** will be obsolete in the future.
7981
82+
8083#### Async interface
8184
8285See async example for usage
@@ -109,6 +112,7 @@ See async example for usage
109112| 0 | Write data checksum status | '0': checksum of last write correct |
110113| | | '1': checksum of last write transfer failed |
111114
115+
112116## Operation
113117
114118See examples
Original file line number Diff line number Diff line change 11//
22// FILE: SHT31.cpp
33// AUTHOR: Rob Tillaart
4- // VERSION: 0.3.0
4+ // VERSION: 0.3.1
55// DATE: 2019-02-08
66// PURPOSE: Arduino library for the SHT31 temperature and humidity sensor
77// https://www.adafruit.com/product/2857
2424// 0.2.6 2021-01-01 patch version 0.2.6
2525//
2626// 0.3.0 2021-01-04 arduino-ci
27+ // 0.3.1 2021-05-27 arduino-lint fixes
2728
2829
2930#include " SHT31.h"
Original file line number Diff line number Diff line change 22//
33// FILE: SHT31.h
44// AUTHOR: Rob Tillaart
5- // VERSION: 0.3.0
5+ // VERSION: 0.3.1
66// DATE: 2019-02-08
77// PURPOSE: Arduino library for the SHT31 temperature and humidity sensor
88// https://www.adafruit.com/product/2857
1414#include " Wire.h"
1515
1616
17- #define SHT31_LIB_VERSION " 0.3.0 "
17+ #define SHT31_LIB_VERSION (F( " 0.3.1 " ))
1818
1919
2020// fields readStatus
Original file line number Diff line number Diff line change 55// PURPOSE: testing the performance at different I2C speeds
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -15,6 +16,7 @@ uint32_t stop;
1516
1617SHT31 sht;
1718
19+
1820void setup ()
1921{
2022 Serial.begin (115200 );
@@ -31,6 +33,7 @@ void setup()
3133 Serial.println ();
3234}
3335
36+
3437void loop ()
3538{
3639 for (uint32_t I2Cfreq = 100000 ; I2Cfreq < 900000 ; I2Cfreq += 50000 )
@@ -56,4 +59,5 @@ void test()
5659 delay (100 );
5760}
5861
62+
5963// -- END OF FILE --
Original file line number Diff line number Diff line change 55// PURPOSE: demo async interface
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -16,6 +17,7 @@ uint32_t cnt;
1617
1718SHT31 sht;
1819
20+
1921void setup ()
2022{
2123 Serial.begin (115200 );
@@ -35,6 +37,7 @@ void setup()
3537 cnt = 0 ;
3638}
3739
40+
3841void loop ()
3942{
4043 if (sht.dataReady ())
Original file line number Diff line number Diff line change 55// PURPOSE: demo
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -15,6 +16,7 @@ uint32_t stop;
1516
1617SHT31 sht;
1718
19+
1820void setup ()
1921{
2022 Serial.begin (115200 );
@@ -31,6 +33,7 @@ void setup()
3133 Serial.println ();
3234}
3335
36+
3437void loop ()
3538{
3639 start = micros ();
Original file line number Diff line number Diff line change 55// PURPOSE: demo heater functions
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
1314SHT31 sht;
1415uint16_t status;
1516
17+
1618void setup ()
1719{
1820 Serial.begin (115200 );
@@ -43,6 +45,7 @@ void setup()
4345 Serial.println (" switched off" );
4446}
4547
48+
4649void loop ()
4750{
4851 // forced switch off
@@ -62,4 +65,5 @@ void printHeaterStatus(uint16_t status)
6265 }
6366}
6467
68+
6569// -- END OF FILE --
Original file line number Diff line number Diff line change 55// PURPOSE: demo (needs 0.2.4 or up)
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -16,6 +17,7 @@ uint32_t stop;
1617SHT31 sht;
1718uint32_t connectionFails = 0 ;
1819
20+
1921void setup ()
2022{
2123 Serial.begin (115200 );
@@ -32,6 +34,7 @@ void setup()
3234 Serial.println ();
3335}
3436
37+
3538void loop ()
3639{
3740 if ( sht.isConnected () )
@@ -59,4 +62,5 @@ void loop()
5962 delay (100 );
6063}
6164
65+
6266// -- END OF FILE --
Original file line number Diff line number Diff line change 55// PURPOSE: demo
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -15,6 +16,7 @@ uint32_t stop;
1516
1617SHT31 sht;
1718
19+
1820void setup ()
1921{
2022 Serial.begin (115200 );
@@ -31,6 +33,7 @@ void setup()
3133 Serial.println ();
3234}
3335
36+
3437void loop ()
3538{
3639 sht.read (); // default = true/fast slow = false
@@ -43,4 +46,5 @@ void loop()
4346 delay (100 );
4447}
4548
49+
4650// -- END OF FILE --
Original file line number Diff line number Diff line change 55// PURPOSE: demo
66// URL: https://github.com/RobTillaart/SHT31
77
8+
89#include " Wire.h"
910#include " SHT31.h"
1011
@@ -15,6 +16,7 @@ uint32_t stop;
1516
1617SHT31 sht;
1718
19+
1820void setup ()
1921{
2022 Serial.begin (115200 );
@@ -31,6 +33,7 @@ void setup()
3133 Serial.println ();
3234}
3335
36+
3437void loop ()
3538{
3639 start = micros ();
@@ -45,4 +48,5 @@ void loop()
4548 delay (100 );
4649}
4750
51+
4852// -- END OF FILE --
You can’t perform that action at this time.
0 commit comments