     }
     else if (index == 5) {
       pm1 = 256 * previousValue + value;
-      Serial.print("{ ");
-      Serial.print("\"pm1\": ");
-      Serial.print(pm1);
-      Serial.print(", ");
+      if(debug){
+        Serial.print("{ ");
+        Serial.print("\"pm1\": ");
+        Serial.print(pm1);
+        Serial.print(", ");
+      }
     }
     else if (index == 7) {
       pm2_5 = 256 * previousValue + value;
-      Serial.print("\"pm2_5\": ");
-      Serial.print(pm2_5);
-      Serial.print(", ");
+      if(debug){  
+        Serial.print("\"pm2_5\": ");
+        Serial.print(pm2_5);
+        Serial.print(", ");
+      }
     }
     else if (index == 9) {
       pm10 = 256 * previousValue + value;
-      Serial.print("\"pm10\": ");
-      Serial.print(pm10);
+      if(debug){  
+        Serial.print("\"pm10\": ");
+        Serial.print(pm10);
+      }
     } else if (index > 15) {
       break;
     }
     index++;
   }
-
+  if(debug){
     Serial.print("Connect to: ");
     Serial.println(host);
- 
-    WiFiClient client;
-    if (client.connect(host, 80)) 
-    {
-      String url = "/log.php?sid=1&pm1=";
-      url += pm1;
-      url += "&pm25=";
-      url += pm2_5;
-      url += "&pm10=";
-      url += pm10;
-      url += "&c=";
-      url += 
-      
-      
+  }
+  WiFiClient client;
+  if (client.connect(host, 80)) {
+    String url = "/log.php?sid=1&pm1=";
+    url += pm1;
+    url += "&pm25=";
+    url += pm2_5;
+    url += "&pm10=";
+    url += pm10;
+    if(debug){  
       Serial.print("Requesting URL for the call: ");
       Serial.println(url);
+    }
       
-      client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" +  "Connection: close\r\n\r\n");
-      delay(10); // 10 milisekunden warten
+    client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" +  "Connection: close\r\n\r\n");
+    delay(10); 
       
-      // Read all the lines of the reply from server and print them to Serial
-      while(client.available()){
-        String line = client.readStringUntil('\r');
-        Serial.print(line);
-      }
+    // Read all the lines of the reply from server and print them to Serial
+    while(client.available()){
+      String line = client.readStringUntil('\r');
+        if(debug)Serial.print(line);
+    }
+    if(debug){
       Serial.println("Website was called, closing connection");
       Serial.print("Current pm25 is: ");
       Serial.print(pm2_5);
       Serial.println(" ugr/m3 ");
-      
-    }else{
+    }
+  }else{
       //EEPROM.write(4, 1);
-      Serial.println("Connection lost");
-    }
-  
-  
+        if(debug)Serial.println("Connection lost");
+  }
   while(Serial.available()) Serial.read();
-  Serial.println(" }");
+  if(debug)Serial.println(" }");
   sensor(false);
   ESP.deepSleep(275 * 1000000);
-  //delay(275000);
   sensor(true);
 }

void setup() {
  Serial.begin(9600);
  Serial.flush();
  Serial.println("Starting Setup"); 
  Serial.print("Connecting to Wifi: ");
  Serial.print(ssid);

  Serial.print("Connecting to " + *ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected. MyIP: ");
  Serial.println(WiFi.localIP());
  pinMode (FAN, OUTPUT );
  sensor(true);
}


#define FAN D6  // Tested with NodeMCU ESP12E 2.0. Can be changed at your risk

bool debug = false;
unsigned int pm1 = 0;
unsigned int pm2_5 = 0;
unsigned int pm10 = 0;

//*-- IoT Information
const char* ssid     = "GTC-Guest";
const char* password = ".gtcguest.";
 
const char* host = "161.72.123.150";  // cloud server in local linux pc

char buf[50];

