Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit 9e8109b

Browse files
committed
Merge pull request #29 from lukeknipe/patch-1
Update AdafruitDHT.py
2 parents edd9b11 + 6007116 commit 9e8109b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/AdafruitDHT.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@
4040
# to 15 times to get a sensor reading (waiting 2 seconds between each retry).
4141
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
4242

43+
# Un-comment the line below to convert the temperature to Fahrenheit.
44+
# temperature = temperature * 9/5.0 + 32
45+
4346
# Note that sometimes you won't get a reading and
4447
# the results will be null (because Linux can't
4548
# guarantee the timing of calls to read the sensor).
4649
# If this happens try again!
4750
if humidity is not None and temperature is not None:
48-
print 'Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity)
51+
print 'Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity)
4952
else:
5053
print 'Failed to get reading. Try again!'
5154
sys.exit(1)

0 commit comments

Comments
 (0)