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 4040# to 15 times to get a sensor reading (waiting 2 seconds between each retry).
4141humidity , 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!
4750if 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 )
4952else :
5053 print 'Failed to get reading. Try again!'
5154 sys .exit (1 )
You can’t perform that action at this time.
0 commit comments