Conflitto librerie ICMPPing e TimeLib.h

Salve, ancora qui a capire qualcosa.
Ho un sketch, dove uso in contemporanea le librerie
ICMPPing e TimeLib.h

Non includendo la libreria ICMPPing (mi serve per sapere se un determinato ip e collegato al WIFI di casa) funziona tutto perfettamente. Quando includo la libreria ICMPPing , la libreria TimeLib (serve per aggiornare l'orario in EthernetUdp), va tutto in blocco. addirittura si perma il LOOP.
Come posso ovviare a questo problema?
Grazie in anticipo.

provare ad usare altre librerie....
probabilmente una o entrambe usano qualche registro o qualche interrupt che all'altra non è gradito

Mi indichereste due librerie alternative. Grazie

Secondo me si può risolvere, ma bisogna capire meglio l'ambiente nel quale operi.
Quali librerie esatte usi attualmente (versione, e/o scaricata da dove)? non parlo poi solo di quelle due, ma ad esempio della Ethernet visto che entrambe se non erro hanno dentro delle "#include Ethernet.h", e potrebbero andare in conflitto su qualcosa (non credo nulla di hardware comunque).

Postaci almeno un estratto del tuo sketch (tutte le righe iniziali con #define #include eccetera, e inizializzazioni, il resto del codice se vuoi tenerlo riservato omettilo) e le esatte versioni delle librerie coinvolte, e vediamo.

Questo è il codice, realizzato per fa lavorare insieme le solo due librerie.

libreria <ICMPPing.h> /* created 30 Sep 2010 by Blake Foster */
libreria <TimeLib.h> sconosciuta la data

#include <SPI.h>
#include <TimeLib.h> 
#include <Ethernet.h>
#include <EthernetUdp.h>
#include "utility/w5100.h"
#include <ICMPPing.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {192,168,1,2}; // IP scelto per la scheda ethernet
int Persona2,Persona1;
unsigned long TempoLetturaPresenza=0L;

int timeZone=1;     
EthernetUDP Udp;  
byte packetBuffer[48];  
time_t prevDisplay=0;
IPAddress timeServer(192, 168, 1, 1); 

String QuestaDATA;
unsigned long OrarioSincornizzato,DifferenzaMillis;

byte PrimoTelefono[] = {192,168,1,11};
byte SecondoTelefono[] = {192,168,1,12}; 



SOCKET pingSocket = 0;
char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

 
unsigned long Tempo=0L;

void setup() 
{
   delay(5000);
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
}



void loop()
{
  Persona1=0; Persona2=0;
  ICMPEchoReply echoReply = ping(PrimoTelefono, 1); if (echoReply.status == SUCCESS) {Persona2=1; SpegniAntifurto(); TempoLetturaPresenza=0L; }  
  ICMPEchoReply echoReply1 = ping(SecondoTelefono, 1);  if (echoReply1.status == SUCCESS) {Persona1=1; SpegniAntifurto(); TempoLetturaPresenza=0L; } 
  if(  ((millis()/1000L) > TempoLetturaPresenza) && (TempoLetturaPresenza>0L) ) {AccendiAntifurto();}
  if( (Persona1==0) && (Persona2==0) && ((millis()/1000L)>TempoLetturaPresenza)  )
    {
      Serial.println(F("RITARDO PER ATTIVAZIONE ANTIFURTO !!!"));
      TempoLetturaPresenza=((millis()/1000L)+15L);
    }
 delay(10000); //ritardo 10 secondi
AggiornaOra();
}



 
void AccendiAntifurto(){Serial.println(F("\n++++++++++++++++++++++++++++> ANTIFURTO INCLUSO DA ASSENZA  PHONE <+++++++++++++++++++++++++++++\n")); TempoLetturaPresenza=((millis()/1000L)+16L);}
void SpegniAntifurto() {Serial.println(F("\n----------------------------> ANTIFURTO ESCLUSO DA PRESENZA PHONE <-----------------------------\n"));}




void AggiornaOra()
{
  Serial.print(F("--> ")); Serial.print(dayShortStr(weekday()) );Serial.print(F(" "));Serial.print(QuestaDATA);Serial.println(F(" <--"));
  QuestaDATA="";
  setSyncProvider(getNtpTime);
  
  ///realizzo l'ora legale dall'ultima domenica di marzo all'ultima domenica di ottobre
  if (month() >= 4 && month() <= 9)  {timeZone=2;} else {timeZone=1;}
  if (month() == 10) { if( ( (weekday()==1) && ((day() + 7) > 31) && (hour()>2) ) || ( (weekday()> 1) && ((day() + 7) > 31) ) )  { timeZone=1;} else {timeZone=2;} }
  if (month() == 3)  { if( ( (weekday()==1) && ((day() + 7) > 31) && (hour()>1) ) || ( (weekday()> 1) && ((day() + 7) > 31) ) )  { timeZone=2;} }

  if ( day() < 10)    {QuestaDATA +="0";} QuestaDATA +=day();   QuestaDATA +="/";
  if ( month() < 10)  {QuestaDATA +="0";} QuestaDATA +=month(); QuestaDATA +="/";
  QuestaDATA +=year(); QuestaDATA +="..";
  if ( hour()   < 10) {QuestaDATA +="0";} QuestaDATA +=hour();   QuestaDATA +=":";
  if ( minute() < 10) {QuestaDATA +="0";} QuestaDATA +=minute(); QuestaDATA +=":";
  if ( second() < 10) {QuestaDATA +="0";} QuestaDATA +=second();

  OrarioSincornizzato= (hour()*60L*60L) ;
  OrarioSincornizzato = OrarioSincornizzato + (minute()*60L) ;
  OrarioSincornizzato = OrarioSincornizzato + second() ;
  DifferenzaMillis = (millis()/1000L); 

  Serial.print(F("--> "));Serial.print(dayShortStr(weekday()) );Serial.print(F(" "));Serial.print(QuestaDATA);Serial.print(F(" <-- DA INTERNET "));

}

time_t getNtpTime()
{
  while (Udp.parsePacket() > 0) ; 
  //Serial.print(F("---Rcihiesta NTP --->"));
  sendNTPpacket(timeServer);
  uint32_t beginWait=millis();
  while (millis() - beginWait < 1500) 
  {
    int SIZE=Udp.parsePacket();
    if (SIZE >=48) {
      //Serial.print(F("NTP Ricevuto "));
      Udp.read(packetBuffer, 48);  
      unsigned long secsSince1900;
      secsSince1900=(unsigned long)packetBuffer[40] << 24;
      secsSince1900 |=(unsigned long)packetBuffer[41] << 16;
      secsSince1900 |=(unsigned long)packetBuffer[42] << 8;
      secsSince1900 |=(unsigned long)packetBuffer[43];
      return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
    }
  }
  //Serial.print(F("Nessun NTP :-( "));
  return 0; 
}
void sendNTPpacket(IPAddress &address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, 48);
  packetBuffer[0]=0b11100011;  
  packetBuffer[1]=0;    
  packetBuffer[2]=6;     
  packetBuffer[3]=0xEC;  
  packetBuffer[12]=49;
  packetBuffer[13]=0x4E;
  packetBuffer[14]=49;
  packetBuffer[15]=52;
  Udp.beginPacket(address, 123);  //NTP requests are to port 123
  Udp.write(packetBuffer, 48);
  Udp.endPacket();
}

Se non vado errato, TimeLib.h è un pezzo della libreria Time di Paul Stoffregen che trovi QUI ...
... hai installato TUTTA la libreria Time ?

Se si puoi verificare i vari esempi, magari trovi qualche cosa che ti aiuta oppure ... armarti di santa pazienza e verificare nei vari moduli, che detta libreria usa, se c'è qualche cosa che va in conflitto con la ICMPPing ::slight_smile:

Guglielmo

Naturalmente la libreria Time di Paul Stoffregen e completa.

bitmanrc:
libreria <ICMPPing.h> /* created 30 Sep 2010 by Blake Foster */
libreria <TimeLib.h> sconosciuta la data

Per la prima ok, non mi sembra ci possano essere problemi (comunque la ICMPPing.h già include alcune librerie ossia SPI.h Ethernet.h e utility/w5100.h).

Per la TimeLib.h invece ho qualche perplessità: possibile che questa non abbia alcun indicatore di versione, autore o date, né tramite la gestione librerie dell'IDE, né nel file alcun commento?

Per dire, vedi QUI è la TimeLib di tal Stoffregen, o QUESTA di derickr. Se fosse una di queste ti basterebbe leggere il file .h.

OK...
la libreria TimeLib è la versione ?!?!?!
ti allego il file in .zip

Time-master.zip (33 KB)

bitmanrc:
la libreria TimeLib è la versione ?!?!?!

Se apri il file "library.properties" (che per le librerie specifica le relative "proprietà" inclusa la versione) leggi questo:

name=Time
version=1.5
author=Michael Margolis
maintainer=Paul Stoffregen
sentence=Timekeeping functionality for Arduino
paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC.
category=Timing
url=Arduino Playground - HomePage
architectures=*

Quindi si, è la versione 1.5 di Stoffregen.

Comunque in generale, se dall'IDE apri Sketch, Include, e selezioni "Gestione librerie" puoi vedere tutte le librerie installate(con un box anche per cercare per note) e quindi accedere a tutte le relative informazioni.

Per tornare al tuo problema quindi, per prima cosa chiarisci meglio cosa intendi con "si blocca al loop".
Identifica dove esattamente si blocca, ossia dividi in singole istruzioni quelle linee dove hai messo più istruzioni ed inserisci qualche Serial.print() per capire dove si ferma, ad esempio non:

  ICMPEchoReply echoReply = ping(PrimoTelefono, 1); if (echoReply.status == SUCCESS) {Persona2=1; SpegniAntifurto(); TempoLetturaPresenza=0L; }

ma:

  Serial.println("Pingo il primo telefono");
  ICMPEchoReply echoReply = ping(PrimoTelefono, 1); 
  if (echoReply.status == SUCCESS) {
    Persona2=1; 
    Serial.println("Spengo antifurto");
    SpegniAntifurto(); 
    Serial.println("Proseguo");
    TempoLetturaPresenza=0L; 
  } 
  Serial.println("Fine if primo telefono");

e così via.

Dove si ferma? Ovviamente posta sia il nuovo codice sia l'output della finestra seriale...

name=Time
version=1.5
author=Michael Margolis
maintainer=Paul Stoffregen
sentence=Timekeeping functionality for Arduino
paragraph=Date and Time functions, with provisions to synchronize to external time sources like GPS and NTP (Internet). This library is often used together with TimeAlarms and DS1307RTC.
category=Timing
url=Arduino Playground - HomePage
architectures=*

la riga dove non va più gia al primo utlizzo e questa
setSyncProvider(getNtpTime); //// si blocca a questo comando/riga, quindi NON fa la richiesta

comunque se lo carichi su arduino e lo vorresti provare, vedi tu stesso.
Quindi Fa il ping ma non fa l'aggiornamento data.

#include <SPI.h>
#include <TimeLib.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include "utility/w5100.h"
#include <ICMPPing.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {192, 168, 1, 2}; // IP scelto per la scheda ethernet
int Persona2, Persona1;
unsigned long TempoLetturaPresenza = 0L;

int timeZone = 1;
EthernetUDP Udp;
byte packetBuffer[48];
time_t prevDisplay = 0;
IPAddress timeServer(192, 168, 1, 1);

String QuestaDATA;
unsigned long OrarioSincornizzato, DifferenzaMillis;

byte PrimoTelefono[] = {192, 168, 1, 11};
byte SecondoTelefono[] = {192, 168, 1, 12};



SOCKET pingSocket = 0;
char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));


unsigned long Tempo = 0L;

void setup()
{
  delay(5000);
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
}



void loop()
{
  Persona1 = 0; Persona2 = 0;
  ICMPEchoReply echoReply = ping(PrimoTelefono, 1);
  if (echoReply.status == SUCCESS) {
    Persona2 = 1;
    SpegniAntifurto();
    TempoLetturaPresenza = 0L;
  }
  ICMPEchoReply echoReply1 = ping(SecondoTelefono, 1);  
  if (echoReply1.status == SUCCESS) {
    Persona1 = 1;
    SpegniAntifurto();
    TempoLetturaPresenza = 0L;
  }
  if (  ((millis() / 1000L) > TempoLetturaPresenza) && (TempoLetturaPresenza > 0L) ) {
    AccendiAntifurto();
  }
  if ( (Persona1 == 0) && (Persona2 == 0) && ((millis() / 1000L) > TempoLetturaPresenza)  )
  {
    Serial.println(F("RITARDO PER ATTIVAZIONE ANTIFURTO !!!"));
    TempoLetturaPresenza = ((millis() / 1000L) + 15L);
  }
  delay(10000); //ritardo 10 secondi
  AggiornaOra();
}




void AccendiAntifurto() {
  Serial.println(F("\n++++++++++++++++++++++++++++> ANTIFURTO INCLUSO DA ASSENZA  PHONE <+++++++++++++++++++++++++++++\n"));
  TempoLetturaPresenza = ((millis() / 1000L) + 16L);
}
void SpegniAntifurto() {
  Serial.println(F("\n----------------------------> ANTIFURTO ESCLUSO DA PRESENZA PHONE <-----------------------------\n"));
}




void AggiornaOra()
{
  Serial.print(F("--> ")); Serial.print(dayShortStr(weekday()) ); Serial.print(F(" ")); Serial.print(QuestaDATA); Serial.println(F(" <--"));
  QuestaDATA = "";
  
 setSyncProvider(getNtpTime); //// si blocca a questo comando/riga, quindi NON fa la richiesta



  ///realizzo l'ora legale dall'ultima domenica di marzo all'ultima domenica di ottobre
  if (month() >= 4 && month() <= 9)  {
    timeZone = 2;
  } else {
    timeZone = 1;
  }
  if (month() == 10) {
    if ( ( (weekday() == 1) && ((day() + 7) > 31) && (hour() > 2) ) || ( (weekday() > 1) && ((day() + 7) > 31) ) )  {
      timeZone = 1;
    } else {
      timeZone = 2;
    }
  }
  if (month() == 3)  {
    if ( ( (weekday() == 1) && ((day() + 7) > 31) && (hour() > 1) ) || ( (weekday() > 1) && ((day() + 7) > 31) ) )  {
      timeZone = 2;
    }
  }

  if ( day() < 10)    {
    QuestaDATA += "0";
  } QuestaDATA += day();   QuestaDATA += "/";
  if ( month() < 10)  {
    QuestaDATA += "0";
  } QuestaDATA += month(); QuestaDATA += "/";
  QuestaDATA += year(); QuestaDATA += "..";
  if ( hour()   < 10) {
    QuestaDATA += "0";
  } QuestaDATA += hour();   QuestaDATA += ":";
  if ( minute() < 10) {
    QuestaDATA += "0";
  } QuestaDATA += minute(); QuestaDATA += ":";
  if ( second() < 10) {
    QuestaDATA += "0";
  } QuestaDATA += second();

  OrarioSincornizzato = (hour() * 60L * 60L) ;
  OrarioSincornizzato = OrarioSincornizzato + (minute() * 60L) ;
  OrarioSincornizzato = OrarioSincornizzato + second() ;
  DifferenzaMillis = (millis() / 1000L);

  Serial.print(F("--> ")); Serial.print(dayShortStr(weekday()) ); Serial.print(F(" ")); Serial.print(QuestaDATA); Serial.print(F(" <-- DA INTERNET "));

}

time_t getNtpTime()
{
  while (Udp.parsePacket() > 0) ;
  //Serial.print(F("---Rcihiesta NTP --->"));
  sendNTPpacket(timeServer);
  uint32_t beginWait = millis();
  while (millis() - beginWait < 1500)
  {
    int SIZE = Udp.parsePacket();
    if (SIZE >= 48) {
      //Serial.print(F("NTP Ricevuto "));
      Udp.read(packetBuffer, 48);
      unsigned long secsSince1900;
      secsSince1900 = (unsigned long)packetBuffer[40] << 24;
      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
      secsSince1900 |= (unsigned long)packetBuffer[43];
      return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
    }
  }
  //Serial.print(F("Nessun NTP :-( "));
  return 0;
}
void sendNTPpacket(IPAddress &address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, 48);
  packetBuffer[0] = 0b11100011;
  packetBuffer[1] = 0;
  packetBuffer[2] = 6;
  packetBuffer[3] = 0xEC;
  packetBuffer[12] = 49;
  packetBuffer[13] = 0x4E;
  packetBuffer[14] = 49;
  packetBuffer[15] = 52;
  Udp.beginPacket(address, 123);  //NTP requests are to port 123
  Udp.write(packetBuffer, 48);
  Udp.endPacket();
}

Controlla qualcos'altro, perchè ho preso l'esempio TimeNTP dalla libreria Time, ho aggiunto le tue righe e funziona

/*
 * Time_NTP.pde
 * Example showing time sync to NTP time source
 *
 * This sketch uses the Ethernet library
 */
 
#include <TimeLib.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <SPI.h>
#include <ICMPPing.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
// NTP Servers:
IPAddress timeServer(217, 147, 223, 78); //europe.pool.ntp.org

const int timeZone = 1;     // Central European Time

EthernetUDP Udp;
unsigned int localPort = 8888;  // local port to listen for UDP packets

SOCKET pingSocket = 0;
char buffer [256];
ICMPPing ping(pingSocket, (uint16_t)random(0, 255));

int Persona2, Persona1;
unsigned long TempoLetturaPresenza = 0L;

String QuestaDATA;
unsigned long OrarioSincornizzato, DifferenzaMillis;

byte PrimoTelefono[] = {192, 168, 1, 11};
byte SecondoTelefono[] = {192, 168, 1, 12};

unsigned long Tempo = 0L;

void setup() 
{
  Serial.begin(9600);
  Serial.println("TimeNTP Example");
  if (Ethernet.begin(mac) == 0) {
    // no point in carrying on, so do nothing forevermore:
    while (1) {
      Serial.println("Failed to configure Ethernet using DHCP");
      delay(10000);
    }
  }
  Serial.print("IP number assigned by DHCP is ");
  Serial.println(Ethernet.localIP());
  Udp.begin(localPort);
  Serial.println("waiting for sync");
  setSyncProvider(getNtpTime);
}

time_t prevDisplay = 0; // when the digital clock was displayed

void loop()
{  
  if (timeStatus() != timeNotSet) {
    if (now() != prevDisplay) { //update the display only if time has changed
      prevDisplay = now();
      digitalClockDisplay();  
    }
  }

  
  Persona1 = 0; Persona2 = 0;
  ICMPEchoReply echoReply = ping(PrimoTelefono, 1);
  if (echoReply.status == SUCCESS) {
    Persona2 = 1;
    Serial.println(" ping primo telefono ok");
    SpegniAntifurto();
    TempoLetturaPresenza = 0L;
  }
  else {
    Serial.println(" ping primo telefono errore");
  }
  ICMPEchoReply echoReply1 = ping(SecondoTelefono, 1);  
  if (echoReply1.status == SUCCESS) {
    Persona1 = 1;
    Serial.println(" ping secondo telefono ok");
    SpegniAntifurto();
    TempoLetturaPresenza = 0L;
  }
  else {
        Serial.println(" ping secondo telefono errore");
  }
  if (  ((millis() / 1000L) > TempoLetturaPresenza) && (TempoLetturaPresenza > 0L) ) {
    AccendiAntifurto();
  }
  if ( (Persona1 == 0) && (Persona2 == 0) && ((millis() / 1000L) > TempoLetturaPresenza)  )
  {
    Serial.println(F("RITARDO PER ATTIVAZIONE ANTIFURTO !!!"));
    TempoLetturaPresenza = ((millis() / 1000L) + 15L);
  }
  delay(10000); //ritardo 10 secondi
  
}

void AccendiAntifurto() {
  Serial.println(F("\n++++> ANTIFURTO INCLUSO DA ASSENZA  PHONE <+\n"));
  TempoLetturaPresenza = ((millis() / 1000L) + 16L);
}
void SpegniAntifurto() {
  Serial.println(F("\n------> ANTIFURTO ESCLUSO DA PRESENZA PHONE <-\n"));
}


void digitalClockDisplay(){
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(month());
  Serial.print(" ");
  Serial.print(year()); 
  Serial.println(); 
}

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

/*-------- NTP code ----------*/

const int NTP_PACKET_SIZE = 48; // NTP time is in the first 48 bytes of message
byte packetBuffer[NTP_PACKET_SIZE]; //buffer to hold incoming & outgoing packets

time_t getNtpTime()
{
  while (Udp.parsePacket() > 0) ; // discard any previously received packets
  Serial.println("Transmit NTP Request");
  sendNTPpacket(timeServer);
  uint32_t beginWait = millis();
  while (millis() - beginWait < 1500) {
    int size = Udp.parsePacket();
    if (size >= NTP_PACKET_SIZE) {
      Serial.println("Receive NTP Response");
      Udp.read(packetBuffer, NTP_PACKET_SIZE);  // read packet into the buffer
      unsigned long secsSince1900;
      // convert four bytes starting at location 40 to a long integer
      secsSince1900 =  (unsigned long)packetBuffer[40] << 24;
      secsSince1900 |= (unsigned long)packetBuffer[41] << 16;
      secsSince1900 |= (unsigned long)packetBuffer[42] << 8;
      secsSince1900 |= (unsigned long)packetBuffer[43];
      return secsSince1900 - 2208988800UL + timeZone * SECS_PER_HOUR;
    }
  }
  Serial.println("No NTP Response :-(");
  return 0; // return 0 if unable to get the time
}

// send an NTP request to the time server at the given address
void sendNTPpacket(IPAddress &address)
{
  // set all bytes in the buffer to 0
  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  packetBuffer[1] = 0;     // Stratum, or type of clock
  packetBuffer[2] = 6;     // Polling Interval
  packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;
  // all NTP fields have been given values, now
  // you can send a packet requesting a timestamp:                 
  Udp.beginPacket(address, 123); //NTP requests are to port 123
  Udp.write(packetBuffer, NTP_PACKET_SIZE);
  Udp.endPacket();
}

bitmanrc:
la riga dove non va più gia al primo utlizzo e questa
setSyncProvider(getNtpTime); //// si blocca a questo comando/riga, quindi NON fa la richiesta

Beh, prima considerazione. Non ho sottomano una Ethernet quindi non posso provare, però mi (ti) chiedo una cosa: la setSyncProvider() serve per specificare la funzione per callback E sincronizzare l'ora, ma perché tu la metti nel loop()? Non so se richiamarla più volte possa dare problemi, ma io quella la metterei nel setup() (come tra l'altro puoi vedere negli esempi allegati alla libreria!), e poi nel loop ti basta chiamare la now().

Poi un'altra cosa per me "strana" è negli include del tuo sketch.
Perché fai anche

#include "utility/w5100.h"

?
Primo, già lo fa la ICMPPing (vedi il .h) quindi non ne hai bisogno, ma secondo, perché con le doppie vigolette (invece di #include <utility/w5100.h>)? Hai una w5100.h "tua" nella cartella dello sketch? Perché?

Insomma, prendi gli esempi sia della ICMPPing sia della TimeLib, se vedi quali #include mettono fai la stessa cosa. In pratica togli la "utility" che non ci va, e lascia solo questi:

#include <SPI.h>
#include <Ethernet.h>
#include <ICMPPing.h>
#include <TimeLib.h>
#include <EthernetUdp.h>

e dimmi che succede.

W5100 mi sono sbagliato. Era per un altra libreria... Proverò con now()...... Siccome perde qualche secondo.... Allora volevo l ora corretta ogni 20 minuti sul mio programma completo. Ho postato solo una parte del totale programmmmmmma. :slight_smile:

NON va, da me NON va nulla. Rifarò tutto il software rendendolo più "ordinato" sia nella logica che nelle variabili.
Per adesso rinvio il mio commento alla fine di GIUGNO. poi vediamo.
A presto su questo argomento.

Un RTC che perde qualche secondo nel giro di minuti? O è bacato o ha la batteria tampone esaurita.