#include <LiquidCrystal_I2C.h>
#include "LCD_1602_RUS.h"
#include "DHTesp.h"
LCD_1602_RUS lcd(0x27, 20, 4);
DHTesp dhtSensor;
unsigned long C_sec, P_sec, C_5_sec, P_5_sec, C_60_sec, P_60_sec = millis();
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
dhtSensor.setup(15, DHTesp::DHT22);
}
void loop() {
C_sec = C_5_sec = C_60_sec = millis();
if (C_sec - P_sec > 1000) {
P_sec = C_sec;
}
if (C_5_sec - P_5_sec > 5000) {
TempAndHumidity data = dhtSensor.getTempAndHumidity();
lcd.setCursor(0, 0); lcd.print("Парилка:");
lcd.setCursor(0, 1); lcd.print("Темп:" + String(data.temperature,0) + "C "+ "Вл:" + String(data.humidity,0) + "%");
P_5_sec = C_5_sec;
}
if (C_60_sec - P_60_sec > 60000) {
TempAndHumidity data = dhtSensor.getTempAndHumidity();
lcd.setCursor(0, 2); lcd.print("Улица:");
lcd.setCursor(0, 3); lcd.print("Т:" + String(data.temperature,0) + "C "+ "В:" + String(data.humidity,0) + "% " + "Д:750мм");
P_60_sec = C_60_sec;
}
}