         rain_counter_reset = false ;
     }
     
-
-}
-
-aws_error_t init_rtc(const char* str_time, const char* str_date) {
-
-    int hour, min, sec;
-    char month[12]; int day, year;
-    uint8_t month_index;
-
-    if (sscanf(str_time, "%d:%d:%d", &hour, &min, &sec) != 3) return AWS_RTC_COMPILER_ERROR;
-    if (sscanf(str_date, "%s %d %d", month, &day, &year) != 3) return AWS_RTC_COMPILER_ERROR;
-
-    tm.Hour = hour;
-    tm.Minute = min;
-    tm.Second = sec;
-
-
-    for (month_index = 0; month_index < 12; month_index++) {
-        if (strcmp(month, month_names[month_index]) == 0) break;
-    }
-
-    if (month_index >= 12) return AWS_RTC_COMPILER_ERROR;
-
-    tm.Day = day;
-    tm.Month = month_index + 1;
-    tm.Year = CalendarYrToTm(year);
-
-    // set this date time to DS1307 chip
-    bool flag = RTC.write(tm);
-    if(!flag) return AWS_RTC_WRITE_ERROR ;
-
-    return AWS_RTC_ERROR_NONE;
 
 }
 

#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 ;

// return codes
DHT22_ERROR_t dht22_code ;

void setup() {

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

    // watchdog enabled
    wdt_enable(WDTO_8S);

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

    setSyncProvider(RTC.get);   
    micro_delay(20);

    if(timeStatus()!= timeSet) {
        // wait a bit
        micro_delay(100);
    }

    // try again
    if(timeStatus()!= timeSet) {
        // CLK error
#if !defined(AWS_NO_SERIAL)
        Serial.println("clock error");
#endif
        for(;;);
    }

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


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