  * 
  */
 
-
+#include <Wire.h>
 #include <DHT22.h>
 #include "Adafruit_BMP085.h"
 
+
+
+#define DHT22_PIN 6
+#define STEEL_MELTING_POINT 1371
+#define AWS_NO_SERIAL 1 
 
 // Analog pin A4(SDA),A5(SCL)
 Adafruit_BMP085 bmp;
 DHT22 myDHT22(DHT22_PIN);
 DHT22_ERROR_t dht22_error;
-
-#define DHT22_PIN 6
-#define STEEL_MELTING_POINT 1371
-#define AWS_NO_LCD 1 
 
 #if !defined(AWS_NO_LCD)
 #include <LiquidCrystal.h>

    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);
    }
}



/*
 * main aws sketch
 *
