from machine import Pin
from time import sleep
import dht
# setup sensor on pin 2
sensor = dht.DHT22(Pin(2))
sleep(2) # initial delay of 2s for DHT22
# Read the values
while True:
try:
# write code to get sensor to measure - see tutorial linked in script
# write code to print temperature in celsius out to serial monitor
sleep(2) #delay of 2s - DHT22 only allows reading every 2s
except KeyboardInterrupt:
break
print("Finished")