adafruit / Adafruit_Python_DHT

Python library to read the DHT series of humidity and temperature sensors on a Raspberry Pi or Beaglebone Black.
MIT License
1.12k stars 980 forks source link

Non-functional on Raspberry Pi B+ on Raspbian stretch #71

Closed pioto closed 7 years ago

pioto commented 7 years ago

It seems that this library may not work on Raspbian stretch; I recently upgraded from jessie, and it seems it hasn't worked since then with my AM2302.

pi@rpi-01:~/git/Adafruit_Python_DHT$ time python ./examples/simpletest.py                                                                   
Failed to get reading. Try again!

real    0m44.628s
user    0m6.430s
sys     0m0.410s
pi@rpi-01:~/git/Adafruit_Python_DHT$ git diff
diff --git a/examples/simpletest.py b/examples/simpletest.py
index 06c4d9e..9849772 100644
--- a/examples/simpletest.py
+++ b/examples/simpletest.py
@@ -24,15 +24,17 @@ import Adafruit_DHT

 # Sensor should be set to Adafruit_DHT.DHT11,
 # Adafruit_DHT.DHT22, or Adafruit_DHT.AM2302.
-sensor = Adafruit_DHT.DHT22
+#sensor = Adafruit_DHT.DHT22
+sensor = Adafruit_DHT.AM2302

 # Example using a Beaglebone Black with DHT sensor
 # connected to pin P8_11.
-pin = 'P8_11'
+#pin = 'P8_11'

 # Example using a Raspberry Pi with DHT sensor
 # connected to GPIO23.
 #pin = 23
+pin = 4

 # Try to grab a sensor reading.  Use the read_retry method which will retry up
 # to 15 times to get a sensor reading (waiting 2 seconds between each retry).
ladyada commented 7 years ago

@PaintYourDragon heya here's one of those GPIO C changeovers!

pioto commented 7 years ago

Let me know if there's any extra tests or diagnostics you need from me to help fix this.

pioto commented 7 years ago

I'm sorry, looks like a small "helper" was playing with my breadboard around when I had done my Raspbian upgrade... Once I corrected the wiring, everything was good.