Open grandehombre opened 4 years ago
The library relies on being called repeatedly so a delay() will indeed cause the non-blocking read to fail. In fact, any operation that takes a long time to execute is likely to cause the non-blocking read to fail.
If you need the best of two worlds--a non-blocking read and the use of delay()--you'd have to either use an operating system or rewrite the non-blocking read so it relies on timer interrupts.
Thank you very much for replying Ole! In the end, I found that if I use millis() to detect a gap of, say 4 seconds, and then blink the lights using delay(), it all works. This method gives the library time to do its work and only holds it up every x seconds. This is in line with what you just said, so all should be fine.
Thanks again,
Cheers, Nick
Hi Ole, Thanks for creating the library and sharing it with us!
I have encountered a strange issue, whereby if I use delay() in my code, the library never returns true in dht_sensor.measure().
Any ideas?
Cheers, Nick
[Update 18 nov 2019] It appears the error comes about if delay() is used in every iteration of loop(). If I put a conditional so it is only used some of the time, all is well. e.g.