File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 40
40
# to 15 times to get a sensor reading (waiting 2 seconds between each retry).
41
41
humidity , temperature = Adafruit_DHT .read_retry (sensor , pin )
42
42
43
+ # Un-comment the line below to convert the temperature to Fahrenheit.
44
+ # temperature = temperature * 9/5.0 + 32
45
+
43
46
# Note that sometimes you won't get a reading and
44
47
# the results will be null (because Linux can't
45
48
# guarantee the timing of calls to read the sensor).
46
49
# If this happens try again!
47
50
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 )
49
52
else :
50
53
print 'Failed to get reading. Try again!'
51
54
sys .exit (1 )
You can’t perform that action at this time.
0 commit comments