         doblink(LED_PIN_RED, 1, 1500);
         doblink(LED_PIN_BLUE, 1, 1500);
         doblink(LED_PIN_GREEN, 1, 1500);
+        
+        wifi_set_sleep_type(LIGHT_SLEEP_T);
   }
 }
 

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

//-------------main functions----------------------------------------
  void doFeed(String sval) {
        int ival = sval.toInt();
        
        for(int a=0; a<ival; a++){
              for(int i=0; i<180; i++){
                 goblink(i);
                 servo.write(i);
                 i = positionTest(i);
                 delay(10);
                 }
                 for(int i=180; i>0; i--){
                 goblink(i);
                 servo.write(i);
                 i = positionTest(i);
                 delay(5);
                 }
                 delay(200); // for fill the bank))
        }
  }
  int positionTest(int i){
    if(servo.read() < (i+10)){
      int j = i-45;
      servo.write(j);
      delay(500);
      i=j;
    }
    return i;
  }
  void goblink(int i){ 
    if ((i%10) == 0){ 
