Blynk server disconnection

potrei eleiminare il debug su monitor seriale…

sorry,

I could delete the serial monitor debug …

error detected: [19460] heartbeat timeout

why do you need delays ?

to be able to view the messages on LCD

Why? The written data isn’t going anywhere until cleared or overwritten… and you can use additional timers to send the viewable data in timeout timer segments.

1 Like

void.......{
lcd.clear(); 
    	lcd.setCursor(4, 0);//colonna e riga del display
    	lcd.print("IP Locale");
    	lcd.setCursor(2,1);//colonna e riga del display
    	lcd.print(WiFi.localIP());
    	timer.setTimeout(1000L,Temper_Serra);
}

void Temper_Serra(){
    	lcd.clear(); 
    	lcd.setCursor(2, 0);//colonna e riga del display
    	lcd.print("Temper. Serra");
    	lcd.setCursor(4,1);//colonna e riga del display
    	lcd.print(T,2);
    	lcd.setCursor(11,1);//colonna e riga del display
    	lcd.print("%");
timer.setTimeout(1000L,Umidita_Serra);
    	}

void Umidita_Serra(){
    	lcd.clear();lcd.setCursor(2, 0);//colonna e riga del display
    	lcd.print("Umidita' Serra");
    	lcd.setCursor(4,1);//colonna e riga del display
    	lcd.print(H,2);
    	lcd.setCursor(11,1);//colonna e riga del display
    	lcd.print("%");
timer.setTimeout(1000L,Luminosita);
}

void Luminosita(){
lcd.clear(); 
    	lcd.setCursor(2, 0);//colonna e riga del display
    	lcd.print("Luminosita'");
    	lcd.setCursor(4,1);//colonna e riga del display
    	lcd.print(100-Luminosita/32767*100, 2);
    	lcd.setCursor(11,1);//colonna e riga del display
    	lcd.print("%");
timer.setTimeout(1000L, Umidita_SX);
    	}

and so on…

1 Like

Thanks Alexis for the answer and suggestions.
I tried to use your code does not actually disconnect from blynk but I can not display the data on the display.
I tried increasing the timer.setTimeout but without result.
… I’m studying the timer function to understand how to use it in this project …
at the moment the code works if I deactivate the LCD display …
thank you

1 Like

could you please post your new formated code so I could help you?

Here it is, thanks Alexis…
in this way it does not disconnect from blynk, but on LCD I display only the first part related to the connection and the last water level …

//--------------------- include librerie utilizzate ----------------------------
 #define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Adafruit_ADS1015.h> 
Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */ 

//--------------------- parametri connessione wi-fi + blynk ----------------------------
char auth[] = "5691xxxxxxxxxxxxx"; // token Serra Domotica


char ssid[] = "TISxxxxxx";
char pass[] = "xxxxxxxxxxxxxxxxx";


//    --------------------- parametri LCD ----------------------------
    int lcdColumns = 16;              // set the LCD number of columns 
    int lcdRows = 2;                  // set the LCD number of rows
    LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);  // set LCD address, number of columns and rows 

//--------------------- definizione variabili ---------------------
  #define DHT1PIN D7    
  #define DHT1TYPE DHT22   
  
  DHT dht1(DHT1PIN, DHT1TYPE);
  SimpleTimer timer;

  float h1 = dht1.readHumidity();
  float t1 = dht1.readTemperature();

  float adc0 = ads.readADC_SingleEnded(0); //fotocellula
  float adc1 = ads.readADC_SingleEnded(1); //umidita Sx
  float adc2 = ads.readADC_SingleEnded(2); //umidita Dx
  float adc3 = ads.readADC_SingleEnded(3); //livello serbatorio


void setup(){
  Serial.begin(9600);             // console debug
  Blynk.begin(auth, ssid, pass);  // avvio connessione

  Wire.begin();
  Wire.setClockStretchLimit (1500);

  dht1.begin();                   // set DHT22
  ads.setGain(GAIN_ONE);          // set valore ADS1115 --> 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV 
  ads.begin();                    // set Adafruit_ADS1015
  lcd.init();                     // set LCD
  lcd.backlight();                // accensione LCD

//--------------------- definizione PIN ---------------------
  pinMode(D0, OUTPUT);// rele soglia <25
//pinMode(D1);// SDA --> LCD + ADS1115
//pinMode(D2);// SLC --> LCD + ADS1115
  pinMode(D3, OUTPUT);// allarme sensore acqua
//pinMode(D4);// RELE LAMPADA 1 via Blynk
//pinMode(D5);// RELE LAMPADA 2 via Blynk
  pinMode(D6, OUTPUT);// rele soglia >25 
//pinMode(D7);// DHT 22
  pinMode(D8, OUTPUT);// inverter BC237
  pinMode(D9, INPUT);// sensore acqua

//--------------------- assegnazione valore iniziale PIN ---------------------    
  digitalWrite(D0, HIGH);
  digitalWrite(D3, LOW);
  digitalWrite(D4, LOW);
  digitalWrite(D5, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D8, LOW);
   
  Serial.print ("IP Locale -->");
  Serial.println (WiFi.localIP());
  Serial.print ("Connessione Blynk OK!  ");
  Serial.println (Blynk.connected());
  Serial.println ("");
}
  
void sensoreDHT(){
  Serial.print ("IP Locale -->");
  Serial.println (WiFi.localIP());
  Serial.print ("Connessione Blynk OK!  ");
  Serial.println (Blynk.connected());
  Serial.println ("");
   
  float t1 = dht1.readTemperature();
  float h1 = dht1.readHumidity();
  t1 = ((int) (t1 * 10) / 10.0);
  h1 = ((int) (h1 * 10) / 10.0);
  
  Blynk.virtualWrite(10, t1); // virtual pin
  Blynk.virtualWrite(11, h1); // virtual pin

     // Check if any reads failed and exit early (to try again).
      if (isnan(t1) || isnan(h1)) {
          Serial.println("Failed to read from DHT #1");
      } 
      else {
            Serial.print("Temperatura interna: "); 
            Serial.print(t1);
            Serial.print ("");
            Serial.println(" gradi /"),(h1);
            Serial.print("Umidita' interna: "); 
            Serial.print(h1);
            Serial.println(" %");
            Serial.println ("");
            }
            delay(2000);
     
      if(t1 < 21)
{ 
        Blynk.virtualWrite(V1, 255);
        digitalWrite(D0, LOW); //accende alimenatore cella Peltier
        delay(1000);
}
    else 
{
        Blynk.virtualWrite(V1, 0);
        digitalWrite(D0, HIGH); //spegne alimenatore cella Peltier
        delay(1000);
}
      if(t1 > 25)
{ 
        Blynk.virtualWrite(V2, 255);
        digitalWrite(D0, LOW);  //accende alimenatore cella Peltier
        digitalWrite(D8, LOW);  //inverter cella Peltier
        delay(1000);
}
    else 
{
        Blynk.virtualWrite(V2, 0);
        digitalWrite(D0, HIGH); //spegne alimenatore cella Peltier
        digitalWrite(D8, HIGH); //spegne inverter cella Peltier
        delay(1000);
}
}
void ads1115(){  
   int16_t adc0, adc1, adc2, adc3; 
   adc0 = ads.readADC_SingleEnded(0); //fotocellula
   adc1 = ads.readADC_SingleEnded(1); //umidita Sx
   adc2 = ads.readADC_SingleEnded(2); //umidita Dx
   adc3 = ads.readADC_SingleEnded(3); //livello serbatorio
   
// Fotocellula - Luminosita
   Serial.print("IN0 Fotocellula: ");   Serial.print(adc0); 
   float Luminosita = (adc0); 
   Serial.print("\  Luminosita: ");  Serial.println(Luminosita/32767*100); 
   Blynk.virtualWrite(V7, (100-Luminosita/32767*100)); // virtual pin
   Serial.println(" "); 
   
// Umidità Sx
   Serial.print("IN1 umiditaSx : "); Serial.print(adc1); 
   float umiditaSx = (adc1); 
   Serial.print("\  Umidita' terreno Sx: ");  Serial.println(umiditaSx/32767*100, 2); 
   Blynk.virtualWrite(V5, (100-umiditaSx/32767*100)); // virtual pin
   float SX = (100-umiditaSx/32767*100);
   Serial.println(" "); 

// Umidità Dx
   Serial.print("IN2 umiditaDx : "); Serial.print(adc2); 
   float umiditaDx = (adc2); 
   Serial.print("\  Umidita' terreno Dx : ");  Serial.println(umiditaDx/32767*100, 2);
   Blynk.virtualWrite(V6, (100-umiditaDx/32767*100)); // virtual pin 
   Serial.println(" "); 
   float DX = (100-umiditaDx/32767*100);
   
     if ((DX <= 45) || (SX <= 45))
{       digitalWrite(D3,HIGH); //Accendi led
        Blynk.virtualWrite(V3, 255);
}
     else {
        digitalWrite(D3,LOW); //Spegni led
        Blynk.virtualWrite(V3, 0);
        delay(1000); //Attende due secondi
}

// Livello serbatoio
   Serial.print("IN3 livello acqua: "); Serial.print(adc3); 
   float livello = (adc3); 
   Serial.print("\  Livello acqua : ");  Serial.println(livello/32767*100, 2);
   Blynk.virtualWrite(V8, (100-livello/32767*100)); // virtual pin 
   Serial.println(" "); 
   float LV = ((100-livello/32767*100));   
        if (LV <= 30)
{
        digitalWrite(D3,HIGH); //Accendi led
        Blynk.virtualWrite(V4, 255);
}
     else {
        digitalWrite(D3,LOW); //Spegni led
        Blynk.virtualWrite(V4, 0);
        delay(1000); //Attende due secondi
}
}
//------------------ visualizzazione LCD ------------

  void LCD(){
  lcd.clear(); 
  lcd.setCursor(2, 0);//colonna e riga del display
  lcd.print("SERVER BLYNK");
  lcd.setCursor(0,1);
  if (!Blynk.connected()){
    lcd.print("NON CONNESSO");}
  else{
    lcd.setCursor(0,1);
  if (Blynk.connected()){
    lcd.print(" CONNESSO");
    timer.setTimeout(1000L,Temper_Serra);}
}

}
void Temper_Serra(){
      float T = dht1.readTemperature();
      T = ((int) (T * 10) / 10.0);
      Serial.print("temperatura lcd : ");  Serial.println(T); 
      Serial.println(" "); 
      
      lcd.clear(); 
      lcd.setCursor(1, 0);//colonna e riga del display
      lcd.print("Temper.  Serra");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(T,2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(1000L,Umidita_Serra);
      }

void Umidita_Serra(){
      float H = dht1.readHumidity();
      H = ((int) (H * 10) / 10.0);
      Serial.print("umidita' lcd : ");  Serial.println(H); 
      Serial.println(" "); 
      lcd.clear();lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' Serra");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(H,2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(1000L,Luminosita);
}

void Luminosita(){
      float Luminosita = adc0;
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Luminosita'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-Luminosita/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(1000L, Umidita_SX);
}

void Umidita_SX(){
      float umiditaSx = adc1;
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' SX'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-umiditaSx/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(1000L, Umidita_DX);
}
void Umidita_DX(){
      float umiditaDx = adc2;
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' DX'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-umiditaDx/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(1000L, Livello_acqua);
}
void Livello_acqua(){
      float LV = adc3;
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Livello acqua");
      lcd.setCursor(5,1);//colonna e riga del display
      lcd.print(100-LV/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");

         if (LV <= 30)
    {
      lcd.clear(); 
      lcd.setCursor(4, 0);//colonna e riga del display
      lcd.print("ALLARME");
      lcd.setCursor(0,1);//colonna e riga del display
      lcd.print("SERBATOIO VUOTO");
      timer.setTimeout(1000L, LCD);
     }
}


void loop(){ 
  Blynk.run();
  timer.run();
  timer.setInterval(5000, sensoreDHT);
  timer.setInterval(5000, ads1115);
  timer.setInterval(5000, LCD);
  timer.setInterval(5000, Temper_Serra);
  timer.setInterval(5000, Umidita_Serra);
  timer.setInterval(5000, Umidita_DX);
  timer.setInterval(5000, Umidita_SX);
  timer.setInterval(5000, Livello_acqua);
}

Oh…my… :open_mouth: Why!!!

I don’t think you understand the concept of setting up a timer yet :stuck_out_tongue: all those go in the void setup() not in the loop where they are trying to run thousands of times a second.

AND, you have them all set to run simultaneously every 5 seconds… so even in the proper location… well, bad, very bad :stuck_out_tongue:

Stagger the timers accordingly so they do not try to run concurrent functions.

1 Like

timer.setInterval must be in setup
you can’t use same timer.setInterval value

replace timer.setInterval(5000, sensoreDHT) with timer.setInterval(60000, sensoreDHT)
no need to get temperature every 5 secs

as functions are called by timer.setTimeout(1000L,…
you only need timer.setInterval(5000, Temper_Serra);

I don’t know if the void ads1115(){ … is correct I never use ads1115

as @Gunner said, you have to understand the concept of setting up the timers first. :wink:

Hi, I thank you for the suggestions I hope to be able to put them into practice.
… you will surely have understood that I am not a programmer …

I have made the suggested changes, below the new code, I hope I have understood and made the right changes.

… at the moment you do not disconnect anymore from blynk but the visualization on LCD is still fast …

I’m working on a scretch to learn how the Timer function works …

//--------------------- include librerie utilizzate ----------------------------
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <Adafruit_ADS1015.h> 
Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */ 

//--------------------- parametri connessione wi-fi + blynk ----------------------------
char auth[] = "56xxxxxxxxxx95"; // token Serra Domotica

char ssid[] = "TISxxxxxx";
char pass[] = "xxxxxxxx";

//--------------------- parametri LCD ----------------------------
int lcdColumns = 16;              // set the LCD number of columns 
int lcdRows = 2;                  // set the LCD number of rows
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);  // set LCD address, number of columns and rows 

//--------------------- definizione variabili ---------------------
  #define DHT1PIN D7    
  #define DHT1TYPE DHT22   
  
  DHT dht1(DHT1PIN, DHT1TYPE);
  SimpleTimer timer;

  float h1 = dht1.readHumidity();
  float t1 = dht1.readTemperature();

  float adc0 = ads.readADC_SingleEnded(0); //fotocellula
  float adc1 = ads.readADC_SingleEnded(1); //umidita Sx
  float adc2 = ads.readADC_SingleEnded(2); //umidita Dx
  float adc3 = ads.readADC_SingleEnded(3); //livello serbatorio

void setup(){
  Serial.begin(9600);             // console debug
  Blynk.begin(auth, ssid, pass);  // avvio connessione
  
  Wire.begin();
  dht1.begin();                   // set DHT22
  ads.setGain(GAIN_ONE);          // set valore ADS1115 --> 1x gain   +/- 4.096V  1 bit = 2mV      0.125mV 
  ads.begin();                    // set Adafruit_ADS1015
  lcd.init();                     // set LCD
  lcd.backlight();                // accensione LCD

//--------------------- definizione PIN ---------------------
  pinMode(D0, OUTPUT);// rele soglia <25
//pinMode(D1);// SDA --> LCD + ADS1115
//pinMode(D2);// SLC --> LCD + ADS1115
  pinMode(D3, OUTPUT);// allarme sensore acqua
//pinMode(D4);// RELE LAMPADA 1 via Blynk
//pinMode(D5);// RELE LAMPADA 2 via Blynk
  pinMode(D6, OUTPUT);// rele soglia >25 
//pinMode(D7);// DHT 22
  pinMode(D8, OUTPUT);// inverter BC237
  pinMode(D9, INPUT);// sensore acqua
  
//--------------------- assegnazione valore iniziale PIN ---------------------    
  digitalWrite(D0, HIGH);
  digitalWrite(D3, LOW);
  digitalWrite(D4, LOW);
  digitalWrite(D5, LOW);
  digitalWrite(D6, LOW);
  digitalWrite(D8, LOW);
   
  Serial.print ("IP Locale -->");
  Serial.println (WiFi.localIP());
  Serial.print ("Connessione Blynk OK!  ");
  Serial.println (Blynk.connected());
  Serial.println ("");
}
  
void sensoreDHT(){
  Serial.print ("IP Locale -->");
  Serial.println (WiFi.localIP());
  Serial.print ("Connessione Blynk OK!  ");
  Serial.println (Blynk.connected());
  Serial.println ("");
   
  float t1 = dht1.readTemperature();
  float h1 = dht1.readHumidity();
  t1 = ((int) (t1 * 10) / 10.0);
  h1 = ((int) (h1 * 10) / 10.0);
  
  Blynk.virtualWrite(10, t1); // virtual pin
  Blynk.virtualWrite(11, h1); // virtual pin
    
     // Check if any reads failed and exit early (to try again).
      if (isnan(t1) || isnan(h1)) {
          Serial.println("Failed to read from DHT #1");
      } 
      else {
            Serial.print("Temperatura interna: "); 
            Serial.print(t1);
            Serial.print ("");
            Serial.println(" gradi /"),(h1);
            Serial.print("Umidita' interna: "); 
            Serial.print(h1);
            Serial.println(" %");
            Serial.println ("");
            }
            delay(2000);
     
      if(t1 < 21)
{ 
        Blynk.virtualWrite(V1, 255);
        digitalWrite(D0, LOW); //accende alimenatore cella Peltier
        delay(1000);
}
    else 
{
        Blynk.virtualWrite(V1, 0);
        digitalWrite(D0, HIGH); //spegne alimenatore cella Peltier
        delay(1000);
}
      if(t1 > 25)
{ 
        Blynk.virtualWrite(V2, 255);
        digitalWrite(D0, LOW);  //accende alimenatore cella Peltier
        digitalWrite(D8, LOW);  //inverter cella Peltier
        delay(1000);
}
    else 
{
        Blynk.virtualWrite(V2, 0);
        digitalWrite(D0, HIGH); //spegne alimenatore cella Peltier
        digitalWrite(D8, HIGH); //spegne inverter cella Peltier
        delay(1000);
}
}
void ads1115(){  
   int16_t adc0, adc1, adc2, adc3; 
   adc0 = ads.readADC_SingleEnded(0); //fotocellula
   adc1 = ads.readADC_SingleEnded(1); //umidita Sx
   adc2 = ads.readADC_SingleEnded(2); //umidita Dx
   adc3 = ads.readADC_SingleEnded(3); //livello serbatorio
   
// Fotocellula - Luminosita
   Serial.print("IN0 Fotocellula: ");   Serial.print(adc0); 
   float Luminosita = (adc0); 
   Serial.print("\  Luminosita: ");  Serial.println(Luminosita/32767*100); 
   Blynk.virtualWrite(V7, (100-Luminosita/32767*100)); // virtual pin
   Serial.println(" "); 
   
// Umidità Sx
   Serial.print("IN1 umiditaSx : "); Serial.print(adc1); 
   float umiditaSx = (adc1); 
   Serial.print("\  Umidita' terreno Sx: ");  Serial.println(umiditaSx/32767*100, 2); 
   Blynk.virtualWrite(V5, (100-umiditaSx/32767*100)); // virtual pin
   float SX = (100-umiditaSx/32767*100);
   Serial.println(" "); 

// Umidità Dx
   Serial.print("IN2 umiditaDx : "); Serial.print(adc2); 
   float umiditaDx = (adc2); 
   Serial.print("\  Umidita' terreno Dx : ");  Serial.println(umiditaDx/32767*100, 2);
   Blynk.virtualWrite(V6, (100-umiditaDx/32767*100)); // virtual pin 
   Serial.println(" "); 
   float DX = (100-umiditaDx/32767*100);
   
     if ((DX <= 45) || (SX <= 45))
{       digitalWrite(D3,HIGH); //Accendi led
        Blynk.virtualWrite(V3, 255);
}
     else {
        digitalWrite(D3,LOW); //Spegni led
        Blynk.virtualWrite(V3, 0);
        delay(1000); //Attende due secondi
}

// Livello serbatoio
   Serial.print("IN3 livello acqua: "); Serial.print(adc3); 
   float livello = (adc3); 
   Serial.print("\  Livello acqua : ");  Serial.println(livello/32767*100, 2);
   Blynk.virtualWrite(V8, (100-livello/32767*100)); // virtual pin 
   Serial.println(" "); 
   float LV = ((100-livello/32767*100));   
        if (LV <= 30)
{
        digitalWrite(D3,HIGH); //Accendi led
        Blynk.virtualWrite(V4, 255);
}
     else {
        digitalWrite(D3,LOW); //Spegni led
        Blynk.virtualWrite(V4, 0);
        delay(1000); //Attende due secondi
}
}
//------------------ visualizzazione LCD ------------

  void LCD(){
  lcd.clear(); 
  lcd.setCursor(2, 0);//colonna e riga del display
  lcd.print("SERVER BLYNK");
  lcd.setCursor(0,1);
  if (!Blynk.connected()){
    lcd.print("NON CONNESSO");}
  else{
    lcd.setCursor(0,1);
  if (Blynk.connected()){
    lcd.print(" CONNESSO");
    timer.setTimeout(60000,Temper_Serra);}
}
}
void Temper_Serra(){
      float T = dht1.readTemperature();
      T = ((int) (T * 10) / 10.0);
      Serial.print("temperatura lcd : ");  Serial.println(T); 
      Serial.println(" "); 
      
      lcd.clear(); 
      lcd.setCursor(1, 0);//colonna e riga del display
      lcd.print("Temper.  Serra");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(T,2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000,Umidita_Serra);
      }

void Umidita_Serra(){
      float H = dht1.readHumidity();
      H = ((int) (H * 10) / 10.0);
      Serial.print("umidita' lcd : ");  Serial.println(H); 
      Serial.println(" "); 
      lcd.clear();lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' Serra");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(H,2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000,Luminosita);
}

void Luminosita(){
      float Luminosita = adc0;
      adc0 = ads.readADC_SingleEnded(0); //fotocellula
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Luminosita'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-Luminosita/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000, Umidita_SX);
}

void Umidita_SX(){
      float umiditaSx = adc1;
      adc1 = ads.readADC_SingleEnded(1); //umidita Sx
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' SX'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-umiditaSx/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000, Umidita_DX);
}
void Umidita_DX(){
      float umiditaDx = adc2;
      adc2 = ads.readADC_SingleEnded(2); //umidita Dx
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Umidita' DX'");
      lcd.setCursor(4,1);//colonna e riga del display
      lcd.print(100-umiditaDx/32767*100, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000, Livello_acqua);
}
void Livello_acqua(){
      float LV = (100-adc3/32767*100, 2);
      adc3 = ads.readADC_SingleEnded(3); //livello serbatorio
         if (LV <= 30){
      lcd.clear(); 
      lcd.setCursor(4, 0);//colonna e riga del display
      lcd.print("ALLARME");
      lcd.setCursor(0,1);//colonna e riga del display
      lcd.print("SERBATOIO VUOTO");
             }
         else{
      lcd.clear(); 
      lcd.setCursor(2, 0);//colonna e riga del display
      lcd.print("Livello acqua");
      lcd.setCursor(5,1);//colonna e riga del display
      lcd.print(LV, 2);
      lcd.setCursor(11,1);//colonna e riga del display
      lcd.print("%");
      timer.setTimeout(60000, LCD);
}
}

void loop(){ 
  Blynk.run();
  timer.run();
  timer.setInterval(5000,ads1115);  
  timer.setInterval(60000,sensoreDHT); 
  LCD();  Temper_Serra(); Umidita_Serra();  
  Umidita_DX();  Umidita_SX();  Livello_acqua();
}

no :wink:
only that in the loop

void loop(){ 
 Blynk.run();
 timer.run();
}

void setup(){
 Serial.begin(9600);             // console debug
 Blynk.begin(auth, ssid, pass);  // avvio connessione

timer.setInterval(5000,ads1115);  
timer.setInterval(60000,sensoreDHT); 

Hi Alexis with the changes you suggest in the Blynk app the DHT sensor data is lost!
… with the code I posted Blynk does not disconnect and the project works.
Only the LCD display is too fast and some data is not displayed.

I can not figure out how to manage the time of displaying individual information to be displayed on LCD …

DHT sensor is lost or failed ?

I saw that you have redundancy between void ads1115() and other void !

timer.setInterval(5000,ads1115);  



failed…

your code is very poorly structured :wink:
too many redundancies

Alexis, how could I fix it?
… I tried with the varibaili goblali but I can not make it work …
… if I exclude the display on the LCD, for how I thought it works even if it is badly written :slight_smile: