Comments (6)
Good morning Stefan,
I tested the examples mainly with an UNO, but I understand you use them with an ESP8266 module.
Can you confirm?
Did you test the other examples?
Did that result in the same error message (no need to dump them here right now)
I'll have a look asap
from sht31.
reverting SHT library to 0.2.1
- selecting sketch - SHT31_I2Cspeed.ino (0.02)
- compiling with UNO works
- compiling ESP32 fails so I can recreate the error (I do not have 8266 nearby so this should be close enough)
from sht31.
OK, compiling now works
- replace void with bool in line 32 of the SHT31.h file
bool begin(const uint8_t address, uint8_t dataPin, uint8_t clockPin);
- replace the setHeatTimeout function in SHT31.cpp so it does not use min()
void SHT31::setHeatTimeout(uint8_t seconds)
{
_heatTimeOut = seconds;
if (_heatTimeOut > 180) _heatTimeOut = 180;
}
Thanks for finding this bug, can you please verify above fix works?
I will prepare a pull request right away.
from sht31.
Ho Rob,
thank you very much. Now it compiles.
Your I2C-speed test also explains how to do fast or slow readings
best regards Stefan
from sht31.
Not investigated the latest Adafruit lib but from my head:
When my library doeas a read(), it reads both the T and H does the math for both and puts them into 2 variables. This takes time (~15 millis). When you call getTemperature() or getHumidity() it just copies the variables from the library to your code. This is fast.
To update the internal variables you must call read again, otherwise you get the cached variables again.
The Adafruit library works slightly differently.
A call to getTemperature() or getHumidity() always reads the sensor again, but when reading the T it ignores the H and vice versa.
So it throws away information e.g. H and most of the time it rereads it immediately again. This results in a double delay (don't know if that is 500 ms but it will do double work. The advantage is that you will have the latest measurement, always.
Conclusion
My library stores all fetched information and can deliver info faster as 99% of the cases applications ask temperature and humidity right after each other. If you want my lib to behave like the Adafruit's, you must call read() before every getTemperature() or getHumidity().
from sht31.
Ho Rob,
thank you very much. Now it compiles.
Your I2C-speed test also explains how to do fast or slow readings
best regards Stefan
I will merge the pull request, thanks for pointing out the bug and testing.
from sht31.
Related Issues (13)
- Exposing the raw temperature and humidity? HOT 6
- SHT31 library two I2C interfaces: example, advice needed HOT 31
- Add lastHeaterStopTime variable to prevent switching on the heater too early HOT 2
- Return 0.0C and 0.0% HOT 5
- isConnected returns true if voltaje to SHT31 is not connected. HOT 4
- SoftWire library + SHT31 library HOT 23
- Using SHT31 in High Humidity Environment HOT 9
- check SHT2x functions added HOT 1
- Heater HOT 5
- SHT31 library with Arduino-ESP32 v2.0.5 HOT 8
- support Wire2 for ESP32
- Question on i2c error handling HOT 23
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sht31.