Arduino ESP8266 after deep sleep will it refresh all memories ?

i wanted to sending telegram message only one time after the sensor range was reached . But after my sensor went to deep sleep when it awake up it will detected the same range and sending the same message again and again it was irritated. I have been tried "Bot_lasttime = 0; " But seems not working well . Is there any way to let it will not sending the same message after recover from a deep sleep ?

void loop() {
  Serial.println("Wake up Waiting 5 sec for sensor detetcing");
  delay(5000);
  Serial.print("\tRange: ");                                                      //empited
  Serial.println(sensor.readRangeSingleMillimeters());
  unsigned long currentMillis = millis();
  static bool Range_reach = false;
  if(sensor.readRangeSingleMillimeters()>80) {
       delay(1000);
       Serial.println("Checking Empited Condition1");
       delay(2000);       //delay 1 second for checking propose.
       Serial.print("\tRange: ");  
       Serial.println(sensor.readRangeSingleMillimeters());     
       Serial.println("Checking Empited Condition2");  
       delay(2000);       //delay 1 second for checking propose.
       Serial.print("\tRange: ");  
       Serial.println(sensor.readRangeSingleMillimeters());
       if(!Range_reach) {     
{
            Serial.println("Reading for sending Empty message");
            delay(1000);
            Serial.print("\tRange: ");
            Serial.println(sensor.readRangeSingleMillimeters());
            delay(2000);
            if(sensor.readRangeSingleMillimeters()>80){
                 Serial.println("sent notifcation1 to Telegram");
                 sendTelegramMessage();
                 delay(bulk_messages_mtbs);
                 Bot_lasttime = 0;  
                 if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }               
                 Serial.println();
                 esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
                 Serial.println("Going to sleep now!");
                 delay(3000);
                 esp_deep_sleep_start();
                 Serial.println("This will never be printed");  
                 Range_reach = false; 
}  
}
}
} 
  else if (sensor.readRangeSingleMillimeters()<30) {        //Full
                 delay(1000);
                 Serial.println("Checking Full Condition1");
                 delay(2000);     //delay 30 second for checking propose.
                 Serial.print("\tRange: ");  
                 Serial.println(sensor.readRangeSingleMillimeters());     
                 Serial.println("Checking Full Condition2");
                 delay(2000);     //delay 30 second for checking propose.
                 Serial.print("\tRange: ");  
                 Serial.println(sensor.readRangeSingleMillimeters());     
                      Serial.println("Reading for sending Full message");
                      delay(1000);
                      Serial.print("\tRange: ");
                      Serial.println(sensor.readRangeSingleMillimeters());
                      delay(2000);
          if(Range_reach) {
                      if(sensor.readRangeSingleMillimeters()<30){
                          Serial.println("sent notifcation2 to Telegram");
                          sendTelegramMessage2();
                          delay(bulk_messages_mtbs);
                          Bot_lasttime = 0;
                          if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
                          Serial.println();
          Range_reach = false;  
                          esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
                          Serial.println("Going to sleep now!");
                          delay(3000);
                          esp_deep_sleep_start();
                          Serial.println("This will never be printed"); 
                       
          
}
}
}
  if(currentMillis - lastTick >= 1000){
    countDown--;
    displayCountdownToSerial(); 
    lastTick += 1000;   
  }  
  }

void displayCountdownToSerial(){
  
  int mins = countDown / 60;
  int secs = countDown % 60;
  Serial.print(" Time Remain To Sleep = ");
  Serial.print(mins);
  Serial.print(" : ");
  Serial.println(secs);

  if(countDown == 0 ){
      esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
      Serial.println("Going to sleep now!");
      delay(3000);
      esp_deep_sleep_start();
      Serial.println("This will never be printed");          
}
}

The answer to the question in the title should be yes.

However, you appear to be using an ESP8266 which is not actually an Arduino, its an ESP8266 that someone has written support for in the Arduino IDE.

You might get a better response if you chnage the title of your post to include 'ESP8266'

srnet:
The answer to the question in the title should be yes.

However, you appear to be using an ESP8266 which is not actually an Arduino, its an ESP8266 that someone has written support for in the Arduino IDE.

You might get a better response if you chnage the title of your post to include 'ESP8266'

thanks remind i will .

Waking from deep sleep on the ESP8266 is pretty much the same as starting the MCU after pressing the reset button. The RAM is cleared and your code will start at setup().
It is possible to store variables in the built in RTC RAM that do survive a reset (but not a power cycle) or you could use the spare areas of flash memory that will also survive a power cycle but be aware you can ony write to flash a finite number of times so you will eventually wear out the flash memory if you write to it a lot.

Riva:
Waking from deep sleep on the ESP8266 is pretty much the same as starting the MCU after pressing the reset button. The RAM is cleared and your code will start at setup().
It is possible to store variables in the built in RTC RAM that do survive a reset (but not a power cycle) or you could use the spare areas of flash memory that will also survive a power cycle but be aware you can ony write to flash a finite number of times so you will eventually wear out the flash memory if you write to it a lot.

thanks very much noties.i will try to recived a sending data by mqtt server then sending the message by mqtt!