 
   // put your main code here, to run repeatedly:
     if (WiFi.status()==WL_CONNECTED){
+            delay(200); //for sleep mode
   server->handleClient();
   timer_remote.run();
   timer_vcc.run();
   timer_broadcast.run();
   timer_schedule.run();
-    }
+    } 
+
 }

String DID = ""; //device ID
String DHEX = ""; //Device md5 hex id based

/*
 * Alternative trigger pin. Needs to be connected to a button to use this pin. It must be a momentary connection
 * not connected permanently to ground. Either trigger pin will work.
 * const int TRIGGER_PIN2 = 13; // D7 on NodeMCU and WeMos.
*/

bool initialConfig = false; // Indicates whether ESP has WiFi credentials saved from previous session
ADC_MODE(ADC_VCC); //for voltage measuring

   
}
String tankState(){
   digitalWrite(OBSTACLE_POWER_PIN, LOW);
   delay(500);
  if(digitalRead(OBSTACLE_PIN) == LOW){
    return "FULL";
  }else{
    return "EMPTY";
  }
   digitalWrite(OBSTACLE_POWER_PIN, HIGH);
}

//------------- end main functions----------------------------------------  
void setup() {
  pinMode(TRIGGER_PIN, INPUT_PULLUP);
  pinMode(MOTOR_PIN, OUTPUT);
  pinMode(LED_PIN_RED, OUTPUT);
  pinMode(LED_PIN_BLUE, OUTPUT);
  pinMode(LED_PIN_GREEN, OUTPUT);
  pinMode(OBSTACLE_POWER_PIN, OUTPUT);
  pinMode(OBSTACLE_PIN, INPUT);
  digitalWrite(LED_PIN_RED, HIGH); //turn off led  
  digitalWrite(LED_PIN_BLUE, HIGH); //turn off led 
  digitalWrite(LED_PIN_GREEN, HIGH); //turn off led 
  digitalWrite(OBSTACLE_POWER_PIN, HIGH); //power off obstacle sensor
  digitalWrite(MOTOR_PIN, HIGH); //power off motor pin 360 servo
  
  int start_time = millis(); // remember starttime
  servo.attach(MOTOR_PIN);
  servo.write(0); // initial position for normal servo!!!!
  
  Serial.begin(115200);
  Serial.print("\n Starting at :");
