from machine import Pin, ADC
from lcd1602 import LCD
from time import sleep
import dht
adc1 = ADC(26)
adc2 = ADC(27)
sensor = dht.DHT22(Pin(9))
ledR = Pin(2,Pin.OUT)
ledG = Pin(3,Pin.OUT)
lcd = LCD()
while True:
lcd.clear()
temp = int(0 + (adc1.read_u16() / 65535) * 100)
hum = int(0 + (adc2.read_u16() / 65535) * 100)
lcd.write(0,0,"Temp: {}°C ".format(temp))
lcd.write(0,1,"Humidity: {:.0f}% ".format(hum) )
sleep(0.5)
if temp > 40:
ledR.value(1)
ledG.value(0)
else:
ledR.value(0)
ledG.value(1)
sleep(0.5)