 byte ID = 10;
 //VirtualWire lib
 #include <VirtualWire.h>
-/* //mit dieser Option gibt es einen Fehler beim Kompilieren
-#undef int
-#undef abs
-#undef double
-#undef float
-#undef round
-*/
 int txPin = 3; //ueber Pin 3 die Daten senden
+//digital Output
+int out1 = 12;
 
-int out1 = 1;
-
-/*
-// Reservierung fuer Display
-int sclPin = 2;
-int scaPin = 0;
-*/
-
+//DHT lib
 int dhtPin = 4;
-//DHT11 und 22 lib
-#include <DHT.h>
-#include <DHT_U.h>
-#define dhtPin 4 //DHT Pin
-// Uncomment the type of sensor in use:
-//#define DHTTYPE DHT11 // DHT 11
-#define DHTTYPE DHT22 // DHT 22 (AM2302)
-//#define DHTTYPE DHT21 // DHT 21 (AM2301)
-DHT_Unified dht(dhtPin, DHTTYPE);
+#include "DHT.h"
+DHT dht;
 
 //Pausen zwischen den Messungen in Millisekunden
-unsigned long stime = 10000; // Zeit fuer Daten Senden
-unsigned long mtime = 10000; // Zeit fuer die Daten Messung
+unsigned long stime = 1800000; // Zeit zwischen den Sendezeiten
+unsigned long mtime = 900000; // Zeit zwischen den Messungen
 
 boolean fanOn; // Boolean Feld fuer den Status vom Luefter.
 


float get_temp() {
  // Read temperature as Celsius (the default)
  
  sensors_event_t event;
  dht.temperature().getEvent(&event);
  return event.temperature;
  
  //return dht.readTemperature();
}

float get_hum() {
  // Read humidity
  
  sensors_event_t event;
  dht.humidity().getEvent(&event);
  return event.relative_humidity;
  
  //return dht.readHumidity();
}

void TransmitData(float temp, float hum) {

  digitalWrite(out1, LOW);
  fanOn = false;
  
  dht.setup(dhtPin);
  //Serial.println(F("setup end"));

}

unsigned long task1, task2 = 0;
void loop() {
  unsigned long currmillis = millis();

  //falls der Luefter laeuft pruefe alle 5 Sekunden die Werte
  if (fanOn) {
    if ((unsigned long)(currmillis - task2) >= 15000) {
      byte i;
      //Serial.println(F("check if hum"));
      if ((float)(get_hum() <= 65.0 || get_hum() <= 70.0)) {
        if (!fanOn) {
          //oeffne die Belueftung und starte den Luefter
          //Serial.println(F("fan ON"));
          digitalWrite(out1, HIGH);
          fanOn = true;
        }
      } else {
        if (fanOn) {
          // switch fan1 off und schliesse den Schlitz
          //Serial.println(F("fan off"));
          digitalWrite(out1, LOW);
          fanOn = false;
        }
