/**
ESP32 + DHT22 Example for Wokwi
https://wokwi.com/arduino/projects/322410731508073042
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
#include "DHTesp.h"
const int DHT_PIN = 15;
DHTesp dhtSensor;
void setup() {
Serial.begin(115200);
dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
void loop() {
TempAndHumidity data = dhtSensor.getTempAndHumidity();
lcd.setCursor(0,0);
lcd.print("Humidity: ");
lcd.print(String(data.humidity, 1));
lcd.print("%");
lcd.setCursor(0,1);
lcd.print("Temp: ");
lcd.print(String(data.temperature, 2));
lcd.print("C");
delay(2000);
}