-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading of getCapacitance() gets "historical data" #11
Comments
I did not experienced this. Do you have waited a bit after starting the sensor? Such a behavious is only known for light measurements as I remember |
It's battery powered sensor so after reading I'm putting it into sleep mode. And I'm not using light sensor (main purpose is soil moisture sensor) |
Can you please check if your problem is a duplicate to #8 and solutions there work too? |
I will try it this evening. |
No It's not the same issue. It's not connected with sleeping/not sleeping. Solution "reading sensor version" also not working. My code is: ` #if defined MY_DEBUG1 int sensorValueM; //First reading gets old value so we need to read twice while (sensor.isBusy()) wait(50); sensor.sleep(); int moistureLevel = min(map(sensorValueM, min_hum_adc, max_hum_adc, 0, 100), 100); moistureLevel = max(0, moistureLevel); #if defined MY_DEBUG1 |
@Miceuz: doyou have an idea?! |
It could be some interaction with Mysensors code |
Yes, this is true. When you are reading the sensor, you are getting data from the last read. If you are doing rare reads, you should do two reads. This is done to avoid clock stretching issues with a lot of the controllers. Clock stretching is very poorly supported over a wide variety of controllers - Raspberry Pi, ESP8266 to name a few important ones. That's why sensor returns a previous reading and makes another one after each call. |
So "it's feature not a bug"? It's battery powered sleeping sensor so reads are indeed rare. |
Well, it's neither feature, nor a bug. A workaround for buggy world. I should add this to the documentation. |
;-)) Thank you for all your support! I will close this one. |
|
First reading of getCapacitance() provide "old data". To get current moisture reading you have to call getCapacitance() twice.
The text was updated successfully, but these errors were encountered: