#include "DHTesp.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // 0x27 is the I2C address for most common 16x2 LCD modules
int pin=33;
DHTesp sensor;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
sensor.setup(pin,DHTesp::DHT22);
lcd.init();
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0); // Set cursor to the first line
lcd.print("ENG.Samah");
delay(2000);
lcd.clear(); // Clear the screen
}
void loop() {
TempAndHumidity data=sensor.getTempAndHumidity();
Serial.println("Temp:"+String(data.temperature,2)+"C"+"\nHumidity:"+String(data.humidity,1)+"%");
Serial.println("------------");
lcd.setCursor(0, 0); // Set cursor to the first line
lcd.println("Temp:"+String(data.temperature,2)+"C");
lcd.setCursor(0, 1); // Set cursor to the first line
lcd.println("Humidity:"+String(data.humidity,1)+"%");
// put your main code here, to run repeatedly:
delay(2000); // this speeds up the simulation
}