joan2937 / lg

Linux C libraries and Python modules for manipulating GPIO
The Unlicense
57 stars 20 forks source link

dhtxx example not reading the 40bits from sensor #21

Open EddyTheCo opened 10 months ago

EddyTheCo commented 10 months ago

I am using a DHT11 module. Also created a class to communicate with it using the c API of this project.

I am quite new to gpio and pulses but I have followed this documentation. When using my testprogram in a raspberry pi, I see that the sensor sends the data following the time between edges. The library measures correctly times of around 78 microsecs for 0 bit and 124 microsecs for 1 bit. The thing is that my class does not get never to read the 40 bits the sensor should send. My class is implemented following your dhtxx.c example, but in the example it seems it is not mandatory to get the 40 bits. How this works then?

The thing is that I have tried many things, changing the configuration and times but the checksum of the data is rarely correct(1 of 256 times is correct=>random).

It is anyone who uses it the dhtxx.c example with good results. I have also compiled the example and return always "DHT_BAD_CHECKSUM". I would appreciate any hint on the problem.