/**************************************************
* Interfacing an I2C LCD and DHT Sensor with ESP32*
* SUBMITTED BY: AQUINO, AALIYAH JENNY ROSE L. *
* SUBMITTED TO: PROF. MICHAEL T. SAMONTE *
* *************************************************/
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define DHTPIN 19
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup () {
lcd.init();
lcd.backlight();
dht.begin();
}
void loop () {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
lcd.setCursor(0, 0);
lcd.print ("Temp: ");
lcd.print (temp);
lcd.print (" C");
lcd.setCursor(0, 1);
lcd.print ("Humidity: ");
lcd.print (hum);
lcd.print ("%");
delay(2000);
}