const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
#include <LiquidCrystal.h>
#include <DHT.h>
//Temperatursensor
#define DHTPIN 7
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
//Bildschirm
LiquidCrystal lcd{rs, en, d4, d5, d6, d7};
void setup() {
lcd.begin(16, 2);
// you can now interact with the LCD, e.g.:
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Hello World!");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Start Test");
delay(2000);
dht.begin();
}
void loop() {
delay(2000);
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.clear();
lcd.setCursor(0,0);
lcd.print(F("Temp.:"));
lcd.print(t);
lcd.print(F("\xDF C"));
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(F("Humidity:"));
lcd.print(h);
lcd.print(F("%"));
}