 #include <Time.h>
 #include <TimeAlarms.h>
 #include <DS1307RTC.h>
-#include <AWS.h>
 
 // @change pins and output modes 
 #define DHT22_PIN 6

float humidity ;
int32_t pressure ;

const char *month_names[12] = {
  "Jan", "Feb", "Mar", "Apr", "May", "Jun",
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};

tmElements_t tm;

// return codes
DHT22_ERROR_t dht22_code ;
aws_error_t rtc_code ;

void setup() {

    // watchdog enabled
    wdt_enable(WDTO_8S);

    // DS1307 RTC 
    // DS1307RTC instance created in DS1307 lib
    // DS1307RTC RTC = DS1307RTC();
    // DS1307RTC constructor calls Wire.begin()
    // sync interval is default 5 minutes

    rtc_code = init_rtc(__TIME__,__DATE__);
    micro_delay(20);

    if(rtc_code == AWS_RTC_ERROR_NONE) {
        setSyncProvider(RTC.get);   
        if(timeStatus()!= timeSet) {
            // wait a bit
            micro_delay(400);
        }

        // try again
        if(timeStatus()!= timeSet) {
          rtc_code = AWS_RTC_SYNC_ERROR ;
        }
    }  

    bmp.begin();  
    // INT0 interrupt
    attachInterrupt(0,isr_pin2,RISING);
    last_irq_time = 0 ;

#if !defined(AWS_NO_SERIAL)
    Serial.begin(9600);
#endif

#if !defined(AWS_NO_GSM)
    gsmSerial.begin(9600);

        rain_counter_reset = false ;
    }
    

}

