Differents esp8266 goes offline at same time!

I have in my Blynk project app Two esp8266 working (one esp8266-01 and a Nodemcu), everyone is independient with his own power.

Today I watched that both devices goes ofline at exactly the same time (10:45 am) without any problem of wifi signal, internet or AC-DC power, so there is posible that Blynk cloud goes down at that time? O maybe there are some restrictions about how much tieme is devide connected to Blynk Cloud?

Then at the afternoon unplugged both devides and plug them again and every one goes online again (doesn´t supose that automatically should goes online when they are offline for some time)??

 #include <Ultrasonic.h>  // se incluye la librería ultrasónica

 Ultrasonic ultrasonic(5,4); // (Trig PIN,Echo PIN)

 // *************************************************************

#include "DHT.h"

#define DHTPIN 0    // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);

//  ******************************************************************

#include <SimpleTimer.h>
SimpleTimer timer;

//  ****************************************************************

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "8a9c8df766c84ed99380391f34d653ea";



void sendUptime()
{
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print(" Temperatura *C: " );  
  Serial.println(t);     

  Serial.print(" Humedad %: " );  
  Serial.println(h);     

  Serial.print("Sensacion termica *C: ");  
  Serial.println(hic);
  
                        

  Blynk.virtualWrite(V1, t);
  Blynk.virtualWrite(V2, h);
  Blynk.virtualWrite(V3,hic);


  
}


//  ********************************************************************************

void setup()              //---------------------------------------------------------------------- SETUP -------------------------------------------------------------
{
  Serial.begin(115200);                 

  

   WiFi.mode(WIFI_STA);

  int cnt = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (cnt++ >= 10) {
      WiFi.beginSmartConfig();
      while (1) {
        delay(1000);
        if (WiFi.smartConfigDone()) {
          Serial.println("");
          BLYNK_LOG("SmartConfig: Success");
          break;
        }
        Serial.print("|");
      }
    }
  }

  WiFi.printDiag(Serial);

  Blynk.config(auth);


  //**********************************************************************    AGREGADO PARA SYNC
    
  while (Blynk.connect() == false) {  }
    
  Blynk.syncAll(); 

  //**********************************************************************

  dht.begin();                      // INICIAR SENSOR DE TEMPERATURA

  timer.setInterval(5000, sendUptime); //1000=1s

  //************************************************************************
}


void loop()                                                           // --------------------------------   LOOP -----------------------------------------------

{

  //****************************************************************************************************** ULTRASONICO 
  
  Serial.print(ultrasonic.Ranging(CM)); // CM or INC    
   Serial.println(" cm" );                                
   delay(100);                                            
   Blynk.virtualWrite(V5, ultrasonic.Ranging(CM));
   delay(200);

   //*******************************************************************************************************
  
  Blynk.run();

  timer.run();

//************************************************************



}

Coding errors causing a flood and disconnection.

You cannot have Blynk.virtualWrite() in the loop(),. It must be behind a timer.

Study the PushData example provided by Blynk.

Also remove all delay()'s from your code and use timers instead.

Thanks Jamin, do you think is good now? Could you give an example about using timers instead of delays?


 #include <Ultrasonic.h>  // se incluye la librería ultrasónica

 Ultrasonic ultrasonic(5,4); // (Trig PIN,Echo PIN)

 // *************************************************************

#include "DHT.h"

#define DHTPIN 0    // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);

//  ******************************************************************

#include <SimpleTimer.h>
SimpleTimer timer;

//  ****************************************************************

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "8a9c8df766c84ed99380391f34d653ea";



void sendUptime()
{
  
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print("Temperatura *C: " );  
  Serial.println(t);     

  Serial.print("Humedad %: " );  
  Serial.println(h);     

  Serial.print("Sensacion termica *C: ");  
  Serial.println(hic);
  
                        

  Blynk.virtualWrite(V1, t);
  Blynk.virtualWrite(V2, h);
  Blynk.virtualWrite(V3,hic);

   //****************************************************************************************************** ULTRASONICO 

   float ult = ultrasonic.Ranging(CM);
    
   Serial.print("Distancia en cm: " ); 
   Serial.println(ult); // CM or INC                                  
                                         
   Blynk.virtualWrite(V5, ult);
   

   //*******************************************************************************************************


  
}


//  ********************************************************************************

void setup()              //---------------------------------------------------------------------- SETUP -------------------------------------------------------------
{
  Serial.begin(115200);                 

  

   WiFi.mode(WIFI_STA);

  int cnt = 0;
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (cnt++ >= 10) {
      WiFi.beginSmartConfig();
      while (1) {
        delay(1000);
        if (WiFi.smartConfigDone()) {
          Serial.println("");
          BLYNK_LOG("SmartConfig: Success");
          break;
        }
        Serial.print("|");
      }
    }
  }

  WiFi.printDiag(Serial);

  Blynk.config(auth);


  //**********************************************************************    AGREGADO PARA SYNC
    
  while (Blynk.connect() == false) {  }
    
  Blynk.syncAll(); 

  //**********************************************************************

  dht.begin();                      // INICIAR SENSOR DE TEMPERATURA

  timer.setInterval(5000, sendUptime); //1000=1s

  //************************************************************************
}


void loop()                                                           // --------------------------------   LOOP -----------------------------------------------

{

  /****************************************************************************************************** ULTRASONICO 
  
   Serial.print(ultrasonic.Ranging(CM)); // CM or INC    
   Serial.println(" cm" );                                
   delay(100);                                            
   Blynk.virtualWrite(V5, ultrasonic.Ranging(CM));
   delay(200);

   //*******************************************************************************************************/
  
  Blynk.run();

  timer.run();

//************************************************************



}

This is the area you need to remove from the loop

   Serial.print(ultrasonic.Ranging(CM)); // CM or INC    
   Serial.println(" cm" );                                
   delay(100);                                            
   Blynk.virtualWrite(V5, ultrasonic.Ranging(CM));
   delay(200);

YES, I commentedout that to remove it from compilation, thanks!

Okay its hard to see with all your massive line comments…

//**********************************************************************

Well. Between you and Blynk Cloud many routers on its way. In case somewhere something goes down your connection will be dropped. So connection drops may happen. This is the normal situation for the internet. And if both hardware went offline at same time most probably this is the case.