Real time clock suddenly doesn't update time and date

Hi guys.
I made a project to control temperature of my house and by a relais turn on and off the heating system.
The project include a real time clock that allow to turn on and off at the selected date and time
It worked very well for all the last winter but last week, suddenly, the value display that show time, date and day of the week, reset themselves and restart from 1/1/1970 thursday 00:00
Now It seems that real time doesn’t syncronize with blynk server.
This is very strange because as I’ve already written the project worked all the last winter with no problem…
The hardware for my project is an Arduino Mega that is connected to internet by an Esp8266.
I’d like to add that all other commands work and than on the app Arduino is signed online.
Any suggestion?
Thanks in advance.

You have given us little to work with… Cloud or Local server? IOS or Android? App version? Library version? and of course, show your code. Blynk is in continuous development, so something has changed, we just need more info. Thanks.

Hi.
I’m sorry. I wouldn’t “steal” too much time to all you.
I try to be more precise. So, first of all, what do you mean for Cloud and local server?
-System Android,
-App version 2.13.4
-Blynk library version 0.3.9
The following is the code of my project. I ask you to sorry me if the code is a little bit confused. :slight_smile:
I hope all those elements will help you to find which is my problem.
Thanks.

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 *
 * This example shows how to use ESP8266 Shield (with AT commands)
 * to connect your project to Blynk.
 *
 * Note: Ensure a stable serial connection to ESP8266!
 *       Firmware version 1.0.0 (AT v0.22) is needed.
 *       You can change ESP baud rate. Connect to AT console and call:
 *           AT+UART_DEF=9600,8,1,0,0
 *       In general, Soft Serial may be unstable.
 *       It is highly recommended to switch to Hard Serial.
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <OneWire.h>
#include <Wire.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "here there's my token";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "here there's my wifi";
char pass[] = "here there's the password";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

int derp;
int LED52;
double tempamb;
double tempman;
double tempprog1;
double tempprog2;
double tempprog3;
double tempprog4;
double tempprog5;
double tempprog6;
double tempprog7;
String tobbiettivo;
String funzionamento;
int progact = 0;
int OraStart1;
int MinutoStart1;
int OraStop1;
int MinutoStop1;
int OraStart2;
int MinutoStart2;
int OraStop2;
int MinutoStop2;
int OraStart3;
int MinutoStart3;
int OraStop3;
int MinutoStop3;
int OraStart4;
int MinutoStart4;
int OraStop4;
int MinutoStop4;
int OraStart5;
int MinutoStart5;
int OraStop5;
int MinutoStop5;
int OraStart6;
int MinutoStart6;
int OraStop6;
int MinutoStop6;
int OraStart7;
int MinutoStart7;
int OraStop7;
int MinutoStop7;
int GiornoStart11;
int GiornoStart12;
int GiornoStart13;
int GiornoStart14;
int GiornoStart15;
int GiornoStart16;
int GiornoStart17;
int GiornoStart21;
int GiornoStart22;
int GiornoStart23;
int GiornoStart24;
int GiornoStart25;
int GiornoStart26;
int GiornoStart27;
int GiornoStart31;
int GiornoStart32;
int GiornoStart33;
int GiornoStart34;
int GiornoStart35;
int GiornoStart36;
int GiornoStart37;
int GiornoStart41;
int GiornoStart42;
int GiornoStart43;
int GiornoStart44;
int GiornoStart45;
int GiornoStart46;
int GiornoStart47;
int GiornoStart51;
int GiornoStart52;
int GiornoStart53;
int GiornoStart54;
int GiornoStart55;
int GiornoStart56;
int GiornoStart57;
int GiornoStart61;
int GiornoStart62;
int GiornoStart63;
int GiornoStart64;
int GiornoStart65;
int GiornoStart66;
int GiornoStart67;
int GiornoStart71;
int GiornoStart72;
int GiornoStart73;
int GiornoStart74;
int GiornoStart75;
int GiornoStart76;
int GiornoStart77;
int AutoOn;
int AutoOff;
int help1 = 0;
int DS18B20_Pin = 10;
OneWire ds(DS18B20_Pin);

SimpleTimer timer;

WidgetRTC rtc;

WidgetLED led1(V27);

BLYNK_ATTACH_WIDGET(rtc, V5);

void setup()
{
  // Set console baud rate
  Serial.begin(9600);
  delay(180000);                 //ritardo per permettere, in caso di blackout temporaneo, di ripristinare la rete WiFi così che l'ESP8266 possa riconnetersi
  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  Blynk.begin(auth, wifi, ssid, pass);
  delay(6000);
  
  rtc.begin();
  
  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);  //frequenza refresh orologio
  timer.setInterval(10000L, tempDisplay);   //frequenza refresh display temperatura ambiente
  timer.setInterval(1000L, modeDisplay);     //frequenza refresh lettera che indica la modalità di funzionamento A o M
  timer.setInterval(3000L, obbiettivoDisplay);   //frequenza refresh temperatura temperatura obbiettivo del programma automatico
  timer.setInterval(300000L, readTemp);       //frequenza di lettura della temperatura ambiente tramite sensore
  timer.setInterval(10000L, regularCheck);     //frequenza controllo parametri per attivazione relè
  
  pinMode(13, OUTPUT);
  pinMode(53, OUTPUT);
  
  float temperature = getTemp();
  tempamb = temperature - 1.1;     //correzione software della lettura temperatura ambiente

}

// Utility function for digital clock display: prints preceding colon and leading 0
void printDigits(int digits)
{
  Serial.print(":");
  if (digits < 10) {
    Serial.print('0');
  }
  Serial.print(digits);
}

// Digital clock display of the time
void clockDisplay()
{
  // You can call hour(), minute(), ... at any time
  // Please see Time library examples for details
  
  BLYNK_LOG("Current time: %02d:%02d:%02d %02d %02d %d %02d",
            hour(), minute(), second(),
            day(), month(), year(), weekday());
            
  String currentTime = String(hour()) + ":" + minute();
  String currentDate = String(day()) + " " + month() + " " + year();
  String currentDay;
  if (weekday()==1){
    currentDay="Dom";
    }
  if (weekday()==2){
    currentDay="Lun";
    }
  if (weekday()==3){
    currentDay="Mar";
    }
  if (weekday()==4){
    currentDay="Mer";
    }
  if (weekday()==5){
    currentDay="Gio";
    }
  if (weekday()==6){
    currentDay="Ven";
    }
  if (weekday()==7){
    currentDay="Sab";
    }
  
  Serial.print("Current time: ");
  Serial.print(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();
  Serial.print(currentDay);
  Serial.println();

  // Send time to the App
  Blynk.virtualWrite(V2, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V3, currentDate);
  // Send date to the App
  Blynk.virtualWrite(V8, currentDay);
}

void tempDisplay(){
  Blynk.virtualWrite(V24, String ((tempamb),1) + "°C");
  Serial.print(tempprog1);
  Serial.print(tempprog2);
  Serial.print(tempprog3);
  Serial.print(tempprog4);
  Serial.print(tempprog5);
  Serial.print(tempprog6);
  Serial.print(tempprog7);
  Serial.print(weekday());
}


void modeDisplay(){
  Blynk.virtualWrite(V25, funzionamento);
}


void obbiettivoDisplay(){
  Blynk.virtualWrite(V26, tobbiettivo);
}

void readTemp(){
  float temperature = getTemp();
  tempamb = temperature - 1.1;     //correzione software della lettura temperatura ambiente
}

/*
BLYNK_WRITE(4){
  derp = param.asInt()+0;
}

void derpalicious() {
  if (derp > 0) {
    digitalWrite(13, HIGH);
  } else {
    digitalWrite(13, LOW);
  }  
  
}
*/

// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin 1
BLYNK_WRITE(V4)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("V4 Slider value is: ");
  Serial.println(pinValue);
  tempman = pinValue;
}

/*
BLYNK_WRITE(V6)
{
  int pinValue1 = param.asInt(); // assigning incoming value from pin V1 to a variable
  // You can also use:
  // String i = param.asStr();
  // double d = param.asDouble();
  Serial.print("V6 Slider value is: ");
  Serial.println(pinValue1);
  tempamb = pinValue1;
}
*/
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin 1


BLYNK_WRITE(V1) {          //scelta della temperatura Manuale
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempman = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempman = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempman = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempman = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempman = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempman = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempman = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempman = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempman = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempman = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempman = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempman = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempman = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempman = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempman = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempman = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempman = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempman = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempman = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempman = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempman = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempman = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempman = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V16) {                    //scelta della temperatura Auto1
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog1 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog1 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog1 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog1 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog1 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog1 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog1 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog1 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog1 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog1 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog1 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog1 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog1 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog1 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog1 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog1 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog1 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog1 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog1 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog1 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog1 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog1 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog1 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V17) {                               //scelta della temperatura Auto2
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog2 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog2 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog2 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog2 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog2 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog2 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog2 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog2 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog2 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog2 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog2 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog2 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog2 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog2 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog2 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog2 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog2 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog2 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog2 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog2 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog2 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog2 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog2 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V18) {                                 //scelta della temperatura Auto3
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog3 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog3 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog3 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog3 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog3 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog3 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog3 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog3 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog3 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog3 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog3 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog3 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog3 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog3 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog3 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog3 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog3 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog3 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog3 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog3 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog3 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog3 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog3 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V19) {                            //scelta della temperatura Auto4
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog4 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog4 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog4 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog4 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog4 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog4 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog4 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog4 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog4 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog4 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog4 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog4 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog4 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog4 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog4 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog4 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog4 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog4 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog4 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog4 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog4 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog4 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog4 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V20) {                         //scelta della temperatura Auto5
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog5 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog5 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog5 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog5 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog5 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog5 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog5 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog5 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog5 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog5 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog5 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog5 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog5 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog5 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog5 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog5 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog5 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog5 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog5 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog5 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog5 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog5 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog5 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V21) {                        //scelta della temperatura Auto6
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog6 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog6 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog6 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog6 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog6 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog6 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog6 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog6 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog6 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog6 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog6 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog6 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog6 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog6 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog6 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog6 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog6 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog6 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog6 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog6 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog6 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog6 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog6 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V22) {                        //scelta della temperatura Auto7
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Item 1 selected");
      tempprog7 = 15;
      break;
    case 2: // Item 2
      Serial.println("Item 2 selected");
      tempprog7 = 15.5;
      break;
    case 3: // Item 3
      Serial.println("Item 3 selected");
      tempprog7 = 16;
      break;
    case 4: // Item 4
      Serial.println("Item 4 selected");
      tempprog7 = 16.5;
      break;
    case 5: // Item 5
      Serial.println("Item 5 selected");
      tempprog7 = 17;
      break;
    case 6: // Item 6
      Serial.println("Item 6 selected");
      tempprog7 = 17.5;
      break;
    case 7: // Item 7
      Serial.println("Item 7 selected");
      tempprog7 = 18;
      break;
    case 8: // Item 8
      Serial.println("Item 8 selected");
      tempprog7 = 18.5;
      break;
    case 9: // Item 9
      Serial.println("Item 9 selected");
      tempprog7 = 19;
      break;
    case 10: // Item 10
      Serial.println("Item 10 selected");
      tempprog7 = 19.5;
      break;
    case 11: // Item 11
      Serial.println("Item 11 selected");
      tempprog7 = 20;
      break;
    case 12: // Item 12
      Serial.println("Item 12 selected");
      tempprog7 = 20.5;
      break;
    case 13: // Item 13
      Serial.println("Item 13 selected");
      tempprog7 = 21;
      break;
    case 14: // Item 14
      Serial.println("Item 14 selected");
      tempprog7 = 21.5;
      break;
    case 15: // Item 15
      Serial.println("Item 15 selected");
      tempprog7 = 22;
      break;
    case 16: // Item 16
      Serial.println("Item 16 selected");
      tempprog7 = 22.5;
      break;
    case 17: // Item 17
      Serial.println("Item 17 selected");
      tempprog7 = 23;
      break;
    case 18: // Item 18
      Serial.println("Item 18 selected");
      tempprog7 = 23.5;
      break;
    case 19: // Item 19
      Serial.println("Item 19 selected");
      tempprog7 = 24;
      break;
    case 20: // Item 20
      Serial.println("Item 20 selected");
      tempprog7 = 24.5;
      break;
    case 21: // Item 21
      Serial.println("Item 21 selected");
      tempprog7 = 25;
      break;
    case 22: // Item 22
      Serial.println("Item 22 selected");
      tempprog7 = 25.5;
      break;
    case 23: // Item 23
      Serial.println("Item 23 selected");
      tempprog7 = 26;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}




I’ve splitted the code in two parts to avoid overcaming the character limit.

BLYNK_WRITE(V7) {                                    //scelta della modalità di funzionamento
  switch (param.asInt())
  {
    case 1: // Item 1
      Serial.println("Funzionamento automatico");
      funzionamento = "A";
      break;
    case 2: // Item 2
      Serial.println("Funzionamento manuale");
      funzionamento = "M";
      tobbiettivo = "/";
      led1.off();
      help1 = 0;
      break;
    default:
      Serial.println("Unknown item selected");
  }
}


BLYNK_WRITE(V9) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart1 = t.getStartHour();
     MinutoStart1 = t.getStartMinute();      
               Serial.println(OraStart1);
            Serial.println(MinutoStart1);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop1 = t.getStopHour();
         MinutoStop1 = t.getStopMinute();       
          
            Serial.println(OraStop1);
            Serial.println(MinutoStop1);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart11 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart11);
    }
    if(i==2){GiornoStart12 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart12);
    }
    if(i==3){GiornoStart13 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart13);
    }
    if(i==4){GiornoStart14 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart14);
    }
    if(i==5){GiornoStart15 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart15);
    }
    if(i==6){GiornoStart16 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart16);
    }
    if(i==7){GiornoStart17 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart17);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V10) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart2 = t.getStartHour();
     MinutoStart2 = t.getStartMinute();      
               Serial.println(OraStart2);
            Serial.println(MinutoStart2);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop2 = t.getStopHour();
         MinutoStop2 = t.getStopMinute();       
          
            Serial.println(OraStop2);
            Serial.println(MinutoStop2);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart21 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart21);
    }
    if(i==2){GiornoStart22 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart22);
    }
    if(i==3){GiornoStart23 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart23);
    }
    if(i==4){GiornoStart24 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart24);
    }
    if(i==5){GiornoStart25 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart25);
    }
    if(i==6){GiornoStart26 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart26);
    }
    if(i==7){GiornoStart27 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart27);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V11) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart3 = t.getStartHour();
     MinutoStart3 = t.getStartMinute();      
               Serial.println(OraStart3);
            Serial.println(MinutoStart3);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop3 = t.getStopHour();
         MinutoStop3 = t.getStopMinute();       
          
            Serial.println(OraStop3);
            Serial.println(MinutoStop3);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart31 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart31);
    }
    if(i==2){GiornoStart32 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart32);
    }
    if(i==3){GiornoStart33 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart33);
    }
    if(i==4){GiornoStart34 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart34);
    }
    if(i==5){GiornoStart35 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart35);
    }
    if(i==6){GiornoStart36 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart36);
    }
    if(i==7){GiornoStart37 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart37);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V12) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart4 = t.getStartHour();
     MinutoStart4 = t.getStartMinute();      
               Serial.println(OraStart4);
            Serial.println(MinutoStart4);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop4 = t.getStopHour();
         MinutoStop4 = t.getStopMinute();       
          
            Serial.println(OraStop4);
            Serial.println(MinutoStop4);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart41 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart41);
    }
    if(i==2){GiornoStart42 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart42);
    }
    if(i==3){GiornoStart43 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart43);
    }
    if(i==4){GiornoStart44 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart44);
    }
    if(i==5){GiornoStart45 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart45);
    }
    if(i==6){GiornoStart46 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart46);
    }
    if(i==7){GiornoStart47 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart47);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V13) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart5 = t.getStartHour();
     MinutoStart5 = t.getStartMinute();      
               Serial.println(OraStart5);
            Serial.println(MinutoStart5);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop5 = t.getStopHour();
         MinutoStop5 = t.getStopMinute();       
          
            Serial.println(OraStop5);
            Serial.println(MinutoStop5);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart51 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart51);
    }
    if(i==2){GiornoStart52 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart52);
    }
    if(i==3){GiornoStart53 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart53);
    }
    if(i==4){GiornoStart54 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart54);
    }
    if(i==5){GiornoStart55 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart55);
    }
    if(i==6){GiornoStart56 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart56);
    }
    if(i==7){GiornoStart57 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart57);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V14) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart6 = t.getStartHour();
     MinutoStart6 = t.getStartMinute();      
               Serial.println(OraStart6);
            Serial.println(MinutoStart6);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop6 = t.getStopHour();
         MinutoStop6 = t.getStopMinute();       
          
            Serial.println(OraStop6);
            Serial.println(MinutoStop6);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart61 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart61);
    }
    if(i==2){GiornoStart62 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart62);
    }
    if(i==3){GiornoStart63 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart63);
    }
    if(i==4){GiornoStart64 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart64);
    }
    if(i==5){GiornoStart65 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart65);
    }
    if(i==6){GiornoStart66 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart66);
    }
    if(i==7){GiornoStart67 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart67);
    }
  }

  Serial.println();
}


BLYNK_WRITE(V15) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
     
     OraStart7 = t.getStartHour();
     MinutoStart7 = t.getStartMinute();      
               Serial.println(OraStart7);
            Serial.println(MinutoStart7);
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
         
         OraStop7 = t.getStopHour();
         MinutoStop7 = t.getStopMinute();       
          
            Serial.println(OraStop7);
            Serial.println(MinutoStop7);         
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
    
    if(i==1){GiornoStart71 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart71);
    }
    if(i==2){GiornoStart72 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart72);
    }
    if(i==3){GiornoStart73 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart73);
    }
    if(i==4){GiornoStart74 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart74);
    }
    if(i==5){GiornoStart75 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart75);
    }
    if(i==6){GiornoStart76 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart76);
    }
    if(i==7){GiornoStart77 = t.isWeekdaySelected(i);
           Serial.println(GiornoStart77);
    }
  }

  Serial.println();
}



void regularCheck(){
  if((tempamb<tempman) && (funzionamento == "M")){
    digitalWrite(53, HIGH);
    led1.on();
  }
  else{
    if((help1 == 0) && (funzionamento == "M")){
    digitalWrite(53, LOW);
    led1.off();
    }
  }
  
  
  if((funzionamento == "A") && (hour() >= OraStart1 || (hour() <= OraStop1)) && (((GiornoStart11 == 1) && (weekday()==2)) || ((GiornoStart12 == 1) && (weekday()==3)) || ((GiornoStart13 == 1) && (weekday()==4)) || ((GiornoStart14 == 1) && (weekday()==5)) || ((GiornoStart15 == 1) && (weekday()==6)) || ((GiornoStart16 == 1) && (weekday()==7)) || ((GiornoStart17 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart1 && hour() == OraStart1){
              help1 = 1;
              Serial.print(tempprog1);
                tobbiettivo = String ((tempprog1),1) + " °C";
                  Serial.print(tobbiettivo);
                  progact = 1;
                 }
                    }
                    
        if((help1 == 1) && (progact == 1) && (tempamb<tempprog1)){digitalWrite(53, HIGH);
          tobbiettivo = String ((tempprog1),1) + " °C";
          led1.on();
            Serial.print(tobbiettivo);
            }
            
        if((help1 == 1) && (progact == 1) && (tempamb>=tempprog1)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog1),1) + " °C";
            led1.off();
            }
                    
       if((hour() == OraStop1) && (progact == 1) && (minute() == MinutoStop1)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }        
  } 
  
 
 if((funzionamento == "A") && (hour() >= OraStart2 || (hour() <= OraStop2)) && (((GiornoStart21 == 1) && (weekday()==2)) || ((GiornoStart22 == 1) && (weekday()==3)) || ((GiornoStart23 == 1) && (weekday()==4)) || ((GiornoStart24 == 1) && (weekday()==5)) || ((GiornoStart25 == 1) && (weekday()==6)) || ((GiornoStart26 == 1) && (weekday()==7)) || ((GiornoStart27 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart2 && hour() == OraStart2){
              help1 = 1;
                tobbiettivo = String ((tempprog2),1) + " °C";
                progact = 2;
                 }
                    }
                    
         if((help1 == 1) && (progact == 2) && (tempamb<tempprog2)){digitalWrite(53, HIGH);
             tobbiettivo = String ((tempprog2),1) + " °C";
             led1.on();
               } 
     
       if((help1 == 1) && (progact == 2) && (tempamb>=tempprog2)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog2),1) + " °C";
            led1.off();
            }        
                    
       if((hour() == OraStop2) && (progact == 2) && (minute() == MinutoStop2)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }       
  }
 
 
 if((funzionamento == "A") && (hour() >= OraStart3 || (hour() <= OraStop3)) && (((GiornoStart31 == 1) && (weekday()==2)) || ((GiornoStart32 == 1) && (weekday()==3)) || ((GiornoStart33 == 1) && (weekday()==4)) || ((GiornoStart34 == 1) && (weekday()==5)) || ((GiornoStart35 == 1) && (weekday()==6)) || ((GiornoStart36 == 1) && (weekday()==7)) || ((GiornoStart37 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart3 && hour() == OraStart3){
              help1 = 1;
                tobbiettivo = String ((tempprog3),1) + "°C";
                progact = 3;
                 }
                    }
                    
         if((help1 == 1) && (progact == 3) && (tempamb<tempprog3)){digitalWrite(53, HIGH);
             tobbiettivo = String ((tempprog3),1) + "°C";
             led1.on();
               }
        
        if((help1 == 1) && (progact == 3) && (tempamb>=tempprog3)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog3),1) + "°C";
            led1.off();
            }
                    
       if((hour() == OraStop3) && (progact == 3) && (minute() == MinutoStop3)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }          
  }
 
 
 if((funzionamento == "A") && (hour() >= OraStart4 || (hour() <= OraStop4)) && (((GiornoStart41 == 1) && (weekday()==2)) || ((GiornoStart42 == 1) && (weekday()==3)) || ((GiornoStart43 == 1) && (weekday()==4)) || ((GiornoStart44 == 1) && (weekday()==5)) || ((GiornoStart45 == 1) && (weekday()==6)) || ((GiornoStart46 == 1) && (weekday()==7)) || ((GiornoStart47 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart4 && hour() == OraStart4){
              help1 = 1;
                tobbiettivo = String ((tempprog4),1) + "°C";
                progact = 4;
                 }
                    }
                    
        if((help1 == 1) && (progact == 4) && (tempamb<tempprog4)){digitalWrite(53, HIGH);
          tobbiettivo = String ((tempprog4),1) + "°C";
          led1.on();
            }
        
        if((help1 == 1) && (progact == 4) && (tempamb>=tempprog4)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog4),1) + "°C";
            led1.off();
            }
                            
       if((hour() == OraStop4) && (progact == 4) && (minute() == MinutoStop4)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }          
  }
 
 
 if((funzionamento == "A") && (hour() >= OraStart5 || (hour() <= OraStop5)) && (((GiornoStart51 == 1) && (weekday()==2)) || ((GiornoStart52 == 1) && (weekday()==3)) || ((GiornoStart53 == 1) && (weekday()==4)) || ((GiornoStart54 == 1) && (weekday()==5)) || ((GiornoStart55 == 1) && (weekday()==6)) || ((GiornoStart56 == 1) && (weekday()==7)) || ((GiornoStart57 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart5 && hour() == OraStart5){
              help1 = 1;
                tobbiettivo = String ((tempprog5),1) + "°C";
                progact = 5;
                 }
                    }
                    
        if((help1 == 1) && (progact == 5) && (tempamb<tempprog5)){digitalWrite(53, HIGH);
            tobbiettivo = String ((tempprog5),1) + "°C";
            led1.on();
              }
         
         if((help1 == 1) && (progact == 5) && (tempamb>=tempprog5)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog5),1) + "°C";
            led1.off();
            }
                    
       if((hour() == OraStop5) && (progact == 5) && (minute() == MinutoStop5)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }          
  }
 
 
 if((funzionamento == "A") && (hour() >= OraStart6 || (hour() <= OraStop6)) && (((GiornoStart61 == 1) && (weekday()==2)) || ((GiornoStart62 == 1) && (weekday()==3)) || ((GiornoStart63 == 1) && (weekday()==4)) || ((GiornoStart64 == 1) && (weekday()==5)) || ((GiornoStart65 == 1) && (weekday()==6)) || ((GiornoStart66 == 1) && (weekday()==7)) || ((GiornoStart67 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart6 && hour() == OraStart6){
              help1 = 1;
                tobbiettivo = String ((tempprog6),1) + "°C";
                progact = 6;
                 }
                    }
                    
        if((help1 == 1) && (progact == 6) && (tempamb<tempprog6)){digitalWrite(53, HIGH);
            tobbiettivo = String ((tempprog6),1) + "°C";
            led1.on();
          }
         
         if((help1 == 1) && (progact == 6) && (tempamb>=tempprog6)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog6),1) + "°C";
            led1.off();
            }
                    
       if((hour() == OraStop6) && (progact == 6) && (minute() == MinutoStop6)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }          
  }
 
 
 if((funzionamento == "A") && (hour() >= OraStart7 || (hour() <= OraStop7)) && (((GiornoStart71 == 1) && (weekday()==2)) || ((GiornoStart72 == 1) && (weekday()==3)) || ((GiornoStart73 == 1) && (weekday()==4)) || ((GiornoStart74 == 1) && (weekday()==5)) || ((GiornoStart75 == 1) && (weekday()==6)) || ((GiornoStart76 == 1) && (weekday()==7)) || ((GiornoStart77 == 1) && (weekday()==1)))){
       if(help1 == 0){
         if(minute() == MinutoStart7 && hour() == OraStart7){
              help1 = 1;
                tobbiettivo = String ((tempprog7),1) + "°C";
                progact = 7;
                 }
                    }
                    
        if((help1 == 1) && (progact == 7) && (tempamb<tempprog7)){digitalWrite(53, HIGH);
            tobbiettivo = String ((tempprog7),1) + "°C";
            led1.on();
            }
         
         if((help1 == 1) && (progact == 7) && (tempamb>=tempprog7)){digitalWrite(53, LOW);
            tobbiettivo = String ((tempprog7),1) + "°C";
            led1.off();
            }
                    
       if((hour() == OraStop7) && (progact == 7) && (minute() == MinutoStop7)){
               digitalWrite(53, LOW); 
                help1 = 0;
                progact = 0;
                tobbiettivo = "/";
                           }          
  }
 
 if (help1 == 0) {
    led1.off();
    
  } 
}


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

}


float getTemp(){
  //returns the temperature from one DS18B20 in DEG Celsius
 
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return -1000;
  }
 
  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
 
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
 
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
 
  ds.reset_search();
 
  byte MSB = data[1];
  byte LSB = data[0];
 
  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;
 
  return TemperatureSum;

}

Years old, go to 0.4.7.

Years old, use correct syntax as per live examples.

Thanks Costas. It’s seems to be solved.
I’ve updated library to 0.4.7 as per your suggestion and deleted the row that you reported me because it was obsolete.
Just one more question. I’ve updated the library and this operation has solved ( it seems) the problem.
This means that once in a while I have to refresh libraries in my working projects and upload refreshed sketches on hardware?

You are already using the Cloud server, so no need to worry about the Local Server - that is for more advanced use case needs.

As @Costas pointed out, just update your library and use the new commands as shown in the examples and you will be up and keeping time again.

Also, just so you know, a good 90% of questions asked here can be answered by just a little searching… For example RTC was changed just a few months ago, and unless one keeps current, things can start failing in old code.

@Gunner I’ve tried to make a search if someone else have had my same problem but unfortunately I didn’t find nothing. Maybe I’ve looked for uncorrect words…I don’t know.
Anyway you have written that RTC was updated few months ago, but my problem came out only last week…
How is it possible?

The key is not necessarily looking for someone else with exact same problem, everyone is different…

Anyhow, I find the best way to troubleshoot is by taking the involved components (RTC) and circumstances (just happened recently) and think about what else has recently changed (your app) … thus an advanced search for the words RTC in Announcement categories would have showed the article I pointed out.

Basic searching for other keywords like RTC, STOPPED, WORKING or even just 1970 would have located many other topics saying their RTC stopped working, then discovering the reason (didn’t update library).

Because your App version was recently updated… and the incompatibilities with new App & old Library finally caught up with you.

Technology is always moving forward, so must our knowledge in troubleshooting it

1 Like

@Gunner Thanks. This evening you teached me some important lessons.
I’ll try to tresaure all your suggestions.
Thanks to all. U did (and U’re doing) a great work especially for all us (newbies) that want ( or believe ) to be programmers. :wink:

1 Like