##############################################################
# DHT 11/22 Temperature + Humidity Sensor Interface #
##############################################################
#
# DHT 11/22 Sensor interface with Raspberry Pi Pico / W / 2 / w2 (Hardware & Simulation)
#
# Check out the link for Code explanation and Hardware details
# Link:
# http://tech.arunkumarn.in/blogs/raspberry-pi-pico/getting-started-with-dht11-22-on-raspberry-pi-pico-using-micropython/
#
#
from machine import Pin
import dht
import time
time.sleep_ms(1000) # Wait for USB to become ready
sensor = dht.DHT22(Pin(9))
while True:
sensor.measure()
temperature = sensor.temperature()
humidity = sensor.humidity()
print(f"Temp: {temperature:0.2f} C")
print(f"Hum: {humidity:0.2f}")
time.sleep_ms(2000)