// UNO DHT22 LCD 1602 LCS
// LIBRARIES
#include "DHT.h"
#include <LiquidCrystal_I2C.h>
// DEFINITIONS
#define DHTTYPE DHT22
#define BAUDRATE 9600 //200, 600, 1200, 1800, 2400, 4800, 9600, 19200, 28800 , 38400 , 57600, 76800 , 115200, 230400
#define DHTPIN 2
#define SLEEP_TIME 1000
#define I2C_ADDR 0x27
#define LCD_COLUMNS 16
#define LCD_LINES 2
#define LCD_POS_R 0
#define LCD_POS_C 0
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(I2C_ADDR, LCD_COLUMNS, LCD_LINES);
// INITIAL SETUP
void setup()
{
lcd.init();
Serial.begin(BAUDRATE);
dht.begin();
lcd.begin(LCD_COLUMNS, LCD_LINES);
lcd.backlight();
}
// PROGRAM CODE
void loop()
{
float temperatur = dht.readTemperature();
float feuchtigkeit = dht.readHumidity();
lcd.setCursor (LCD_POS_R,LCD_POS_C);
lcd.setCursor (0,0);
lcd.print("rF: ");
lcd.print(feuchtigkeit);
lcd.print(" %");
lcd.setCursor (0,1);
lcd.print("T : ");
lcd.print(temperatur);
lcd.print(" Grad C");
delay(SLEEP_TIME);
}