     }
 }
 
-void serial_output() {
+#if !defined(AWS_NO_SERIAL)
+void serial_output(DHT22_ERROR_t dht22_error) {
     Serial.print("Yuktix H ");
     if(dht22_temp > STEEL_MELTING_POINT) { 
-        Serial.println("ERR");
-        Serial.print("T ");
-        Serial.print("ERR");
+        Serial.println("ERR ");
+        Serial.print(dht22_error);
+        
     } else {
         Serial.println(humidity);
         Serial.print("T ");

    if(dht22_temp > STEEL_MELTING_POINT) { 
        lcd.print("ERR");
        lcd.setCursor(0,1);
        lcd.print("T ");
        lcd.print("ERR");
    } else {
        lcd.print(humidity);
        lcd.setCursor(0,1);
        lcd.print("T ");
        lcd.print(dht22_temp);
    }

    lcd.print(" P ");
    lcd.print(pressure);
    lcd.print(" R ");
    lcd.print(rain_counter);
}

void loop() {

    dht22_error = myDHT22.readData();

    if(dht22_error == DHT_ERROR_NONE) {
        dht22_temp = myDHT22.getTemperatureC();
        humidity = myDHT22.getHumidity();
    } else {
        // absurd value
        dht22_temp = 9999.0 ;
    }

    pressure = bmp.readPressure();
    // bmp085_temp = bmp.readTemperature();

#if !defined(AWS_NO_SERIAL)
    serial_output();
#endif

#if !defined(AWS_NO_LCD)
    lcd_output();
#endif

    // 1 min. delay
    // DHT22 pins need 2 seconds
    for(int i = 0 ; i < 6000 ; i++) {
        delayMicroseconds(10000);
    }
}

    Serial.print(rain_counter);

}
#endif

#if !defined(AWS_NO_LCD)
void lcd_output(DHT22_ERROR_t dht22_error) {
  
    int t1 ;
    int p1 ;
    int h1 ;
    
    pinMode(lcd_pin, OUTPUT);
    digitalWrite(lcd_pin, HIGH);
    lcd.begin(16,2);       
