Skip to content
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

Feature request: changing sensor type #203

Open
ilmanowar opened this issue Apr 21, 2023 · 0 comments
Open

Feature request: changing sensor type #203

ilmanowar opened this issue Apr 21, 2023 · 0 comments

Comments

@ilmanowar
Copy link

ilmanowar commented Apr 21, 2023

I have a large sketch, which is used either with DHT11 or DHT22. I am wondering if it is possible to let automatically find the right sensor type.
When the sensor type is wrongly set up, the readout fails or gives non-sense values.
In that case, I would try to redefine the type of sensor and try the readout again.
This will allow me to have a single program for all my devices (a sort of autodetect for the sensor type).
In my tests, I was not able to start the readout again after recreating the object with the new sensor type.
I have this initialization in the header:
DHT_Unified dht(2, DHT22);

I hade this in the setup:
dht.begin();

In the loop, once the failed readouts are more than 10 without any good one, the program executes:

DHT_Unified dht(2, DHT11);
dht.begin();

My approach is not working because I continue to fave failed readouts. It seems that the sensor type definition cannot be changed on the run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant