#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "DHT.h"
LiquidCrystal_I2C lcd(0x27,16,2);
DHT dht22(2,DHT22);
float h=0.0;
float t=0.0;
float hlast=0.0;
float tlast=0.0;
char TStr[4];
char HStr[4];
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();// Включаем подсветку дисплея
lcd.print("iarduino.ru");
lcd.setCursor(8, 1);
lcd.print("LCD 1602");
dht22.begin();
lcd.clear();
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
h = dht22.readHumidity();
t = dht22.readTemperature();
lcd.setCursor(0,0);
lcd.print(h);
lcd.setCursor(0,1);
lcd.print(t);
/*
if((h != hlast) || (t != tlast))
{
dtostrf(h,2,1,HStr); // преобразование в строку char
dtostrf(t,2,1,TStr);
}
*/
}