fix dht.c error: can't read data from DHT 11 #485
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
I notice when I use the example
gpio/dht_sensor
in right way, Pico can't read data from DHT11. It toke a night and after reading datasheet https://www.mouser.com/datasheet/2/758/DHT11-Technical-Data-Sheet-Translated-Version-1143054.pdf, I find this error according 2 errors:count
(accumulated time) is 26~28, because 26~28 means data "0", If it is longer, it means data "1". But for redundancy, I choose 35 (I test it works well).This is first time I find this error [Why DHT11 not work after some times using C in pico - Raspberry Pi Forums](https://forums.raspberrypi.com/viewtopic.php?t=355462l), in this post, I use USB and minicom on Mac.
Recently, I buy a Raspberry Pi 4B to re-test this error following the document Raspberry Pi Pico C/C++ SDK by UART, this error still exists. It displays:
The print's dislocation may be according to I ssh to raspberry pi. But the data from DHT11 also are
0
, and printBad data
.After fixing, it displays:
![截屏2024-03-28 23 30 45](https://private-user-images.githubusercontent.com/78771985/317796378-aea350b8-78bb-4345-95f3-08c483dbcaa4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNjgyNjUsIm5iZiI6MTcyMTA2Nzk2NSwicGF0aCI6Ii83ODc3MTk4NS8zMTc3OTYzNzgtYWVhMzUwYjgtNzhiYi00MzQ1LTk1ZjMtMDhjNDgzZGJjYWE0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE1VDE4MjYwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5YjVlZmY2ZjBkN2UwOGFiZDhkN2UzZTE0ZmI4MjA5ODRlMzcyNWY0MjJiZWMzMzExNmE2ODQ3ZTEyOWQ2ZTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5_nEtcY5evOTMLXdNXkV3BnxtnqKib2L059-23yR0dE)
It works well.