Re: DHT2302 Sensor
You need to change that initial usleep to be longer in their code after the first gpio output is set. i did some digging deeper in the datasheet, and actually got it working in python as well using the RPi.GPIO module actually (can't say it's pure python since the RPi.GPIO module is doing gpio via ctypes, but i found it's fast enough on the raspberry using time it).. I basically run a renice'd while loop (with the condition being a 500 count) and just collecting time.time() and the output of the pins, and nothing else in that loop (other than incrementing the counter) so it runs as fast as possible. I then process all the data collected outside the loop when i have more time:
cynikal@raspberrypi ~/raspberry-pi-files $ sudo ./dht-test-rpi-gpio.py
[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0]
It's not perfect either and i more did it for the challenge of it than anything else, since the timing on this thing is so picky you can't get it working 100% of the time either (even in their C code it seems).. but it's considered "a low-cost sensor" so you have to basically live with it (or so i get that impression from everything i read).