/******************************************************************
* Interfacing an I2C LCD and DHT Sensor with ESP32 Microcontroller for Temperature and Humidity Monitoring *
* SUBMITTED BY: INOCENCIO, RAMIRA MAE G. *
* SUBMITTED TO: PROF. MICHAEL T. 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, 20, 4);
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("%");
lcd.setCursor(0,2);
lcd.print("CREATED BY:");
lcd.setCursor(0,3);
lcd.print("RAMIRA MAE INOCENCIO");
delay(100);
}
esp:VIN
esp:GND.2
esp:D13
esp:D12
esp:D14
esp:D27
esp:D26
esp:D25
esp:D33
esp:D32
esp:D35
esp:D34
esp:VN
esp:VP
esp:EN
esp:3V3
esp:GND.1
esp:D15
esp:D2
esp:D4
esp:RX2
esp:TX2
esp:D5
esp:D18
esp:D19
esp:D21
esp:RX0
esp:TX0
esp:D22
esp:D23
lcd1:GND
lcd1:VCC
lcd1:SDA
lcd1:SCL
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND