#include <LiquidCrystal_I2C.h>
#include "DHT.h"

#define DHTPIN 2     


#define DHTTYPE DHT22   
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 20, 4);


void setup() {

  dht.begin();

  lcd.init();
  // print a message to the LCD
  lcd.backlight();
  lcd.setCursor(2,3);
  lcd.print("Lernfeld LF07-V2");
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  

  lcd.setCursor(3,0);
  lcd.print("Messung laeuft");
  lcd.setCursor(0,1);
  lcd.print("Temperatur: "+String(t,1) +" C");
  
  lcd.setCursor(0,2);
  lcd.print("Feuchtigkeit: "+String(h,1) + " %");
 }