hello all, Im a noob to python and raspberry pi. Ive started playing around with some of the modules. the sensor is AM2302 im using adafuit dht library
When running simple temp and humidity script I see the output temp is in C. I would like to change F. Is there a way to do that in the following line?
heres the full code
When running simple temp and humidity script I see the output temp is in C. I would like to change F. Is there a way to do that in the following line?
print("Temp={0:.1f}C Humidity={1:0.1f}%".format(temperature , humidity))Im not understanding the 0:0.1f or the 1:0.1f .... is the f for float?
heres the full code
import Adafruit_DHT import time DHT_SENSOR = Adafruit_DHT.DHT22 DHT_PIN = 4 while True: humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN) if humidity is not None and temperature is not None: print("Temp={0:.1f}C Humidity={1:0.1f}%".format(temperature , humidity)) time.sleep(3);
buran write Nov-11-2020, 07:04 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.