from machine import Pin,I2C
from utime import sleep
import dht
#lcd library#
from lcd_api import LcdApi
from i2c_lcd import I2cLcd
#lcd initialize#
i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR = 0x27
lcd= I2cLcd(i2c, I2C_ADDR, 2, 16)
led = Pin(3,Pin.OUT)
#EO lcd initialize#
lcd.clear()
lcd.putstr("Data Display")
sleep(1)
while True:
dht_sensor = dht.DHT22(Pin(2))
dht_sensor.measure()
temp =dht_sensor.temperature()
hum=dht_sensor.humidity()
lcd.clear()
lcd.putstr("Temp:")
lcd.putstr(str(temp))
lcd.putstr("C")
lcd.move_to(0,1)
lcd.putstr("Humidity:")
lcd.putstr(str(hum))
lcd.putstr("%")
if temp > 39 and hum <30:
led.on()
else:
led.off()