Open woodz- opened 4 months ago
The cause is simple, your timing jitters. The cure is difficult.
The code is more or less a foundation on which to build further. For example, no threading is used. In practice, all processes run simultaneously parallel to the DHT22 code and can influence the timing. As can be found in the documentation, timing needs to be quite precise.
You can address the issue from two sides.
When compiling and running your program with g++
the output looks like
Note I've been reformatting the output a bit and changing the loop delay to 5000ms in
main.cpp
.We can see zero values and sporadic doubled temperature values and +100 humidity values.
Why is that?