/************************************************ 
TITLE: Interfacing an I2C LCD and DHT Sensor with 
ESP32 Microcontroller for Temperature and Humidity Monitoring
SUBMITTED BY: AQUINO, KEN HEART 
SUBMITTED TO: PROF. MICHAEL SAMONTE 
***********************************************/
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 4);
void setup() 
{
lcd.init(); // initialize the LCD
lcd.backlight(); // turn on backlight
dht.begin(); // initialize DHT11 sensor
}


void loop() {
float temp = dht.readTemperature(); // read temperature data from DHT11
float hum = dht.readHumidity(); // read humidity data from DHT11
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(" %");
lcd.setCursor(0, 2);
lcd.print("Created By:");
lcd.setCursor(0, 3);
lcd.print("Michael T. Samonte");
//lcd.print(" %");
}