#include <LiquidCrystal_I2C.h>
#include "DHTesp.h"
const int DHT_PIN = 15;
DHTesp sensor;
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
void printlcd(){
LCD.clear();
LCD.setCursor(0, 0);
TempAndHumidity data = sensor.getTempAndHumidity();
LCD.println("HMCC");
LCD.setCursor(6, 0);
LCD.println("TMP:"+ String(data.temperature, 2)+ "C");
LCD.setCursor(6, 1);
LCD.println("HUM:"+ String(data.humidity, 1)+ " %");
}
void setup() {
Serial.begin(115200);
sensor.setup(DHT_PIN, DHTesp::DHT22);
LCD.init();
LCD.backlight();
LCD.setCursor(3, 0);
LCD.print("BEM VINDO!");
LCD.setCursor(5, 1);
LCD.print("THIAGO");
delay(5000);
printlcd();
}
void loop() {
// put your main code here, to run repeatedly:
delay(5000);
printlcd();
}