#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
LiquidCrystal_I2C lcd(0x27, 16, 2); // I2C address 0x27 (from DIYables LCD), 16 columns and 2 rows
DHT dht(DHTPIN, DHTTYPE);

void setup() {
    dht.begin(); // Initialize the sensor
    lcd.init(); // Initialize the LCD
    lcd.backlight(); // Turn on the backlight
}

void loop() {
    delay(2000); // Wait a few seconds between measurements
    float humidity = dht.readHumidity(); // Read humidity
    float tempC = dht.readTemperature(); // Read temperature in Celsius
    

    lcd.clear(); // Clear the LCD display

        lcd.setCursor(0, 0);
        lcd.print("Temp: ");
        lcd.print(tempC);
        lcd.print((char)223); // Degree symbol
        lcd.print("C");

        lcd.setCursor(0, 1);
        lcd.print("Humi: ");
        lcd.print(humidity);
        lcd.print("%");


}