I'm new here on forum but nevertheless here's a library for DHT11 sensor (3 pin version):
I did this as part of my bachelor degree project and since I saw that the original link that I got the datasheet from is broken (even the ones in the datasheet) I also made a copy of it on the GitHub.
Feel free to use any of the stuff there you find useful!
The structure of your repository is not beginner friendly because it makes the library installation process more difficult.
Best practices for Arduino library repositories is to have one repository dedicated to each library with the library in the root of the repository. That will permit the popular installation method:
- (On GitHub) Clone or download > Download .ZIP
- (In the Arduino IDE) Sketch > Include library > Add .zip library
This repository structure is also required if you want to add your library to the Library Manager index to make installation and updates even easier.
Thanks for the suggestion pert!
I'll do as you said
eh, well, I didn't do what you suggested but I accepted your pull request and thank you for taking your time to do what I should have done pert!
I'm in a bit of a mess in my life right now so the stuff I was hoping to do will be delayed by unknown amount of time
Anyway, thanks again and best regards to all!
I hope your situation will be better soon.
Best wishes, Per
The old shortcutting the signal mistake
digitalWrite(this->_comm_pin, HIGH); // shortcut !
The first datasheets of the DHT11 (in Chinese) are not very clear about the open-collector or open-source behaviour of the signal wire. That is why some libraries make the signal OUTPUT and HIGH. That causes a shortcut in the signal.
Finally someone actually showed the shortcut with a scope: https://github.com/adafruit/DHT-sensor-library/issues/48
Ignore any confusing information in the datasheet. The pictures in the datasheet are sometimes wrong. The signal wire is a open-collector or open-source signal. Do not set the Arduino to OUTPUT and HIGH.
Set the signal as INPUT and led the pullup resistor make the signal high.
A second problem is the sequence of code when setting the pin as OUTPUT LOW. As far as I know, every Atmel microcontroller allows that the output value can be written before a pin is set as output.
To be sure that the pin never gets OUTPUT and HIGH when setting a pin OUTPUT LOW, you can alter the sequence:
// Not good
// When the pin is set as OUTPUT, it might become high, depending on a previous state.
pinMode(this->_comm_pin, OUTPUT); // could create a shortcut
// The pin becomes never OUTPUT HIGH.