Problema con TimeSpan y Rtc

Buenas estoy intentando restar dos fechas, una siendo el presente, y la otra una misma fecha todos los años, ej: ( now.year(), 10, 5,) ( para 10 de mayo del presente)..
Mi problema viene con las librerias para utilizar datetime now, necesito incluir rtc3231 y me dice "no matching function for call to 'DateTime::DateTime(int, int, int, int, int, int, int)', adjunto el codigo

RTC_DS3231 rtc;
 DateTime now = rtc.now();
DateTime dt(now.year(), 6, 8, 14,39, 34, 2);
DateTime t1 (now.year(),7,14,8,0,0);           //2018-7-14 8:00:00
          //2018-7-14 18:00:00 
//Calculos 1


void setup() {
  
    Serial.begin(9600); 

  rtc.begin();
 rtc.setDateTime(rtc);
 
}
void loop() {
 DateTime now = rtc.now();
TimeSpan t3 = dt - t1;
//Mostrar
Serial.println(t3.days());     
Serial.println("d"); //0
Serial.println(t3.hours()); 
Serial.println(":"); //10
Serial.println(t3.minutes());
Serial.println(":"); //0
Serial.println(t3.seconds());               //0
}

que es lo que estoy haciendo mal o me esta faltando? gracias

Te da ese error porque

DateTime dt(now.year(), 6, 8, 14,39, 34, 2);

tiene un parámetro de más.

La declaración de una variable DateTime debe ser

DateTime variable (año,mes,dia,hora,min,seg);

Por otro lado

Por favor pasá el link a esa librería así vemos si cambia las definiciones, porque conozco las librerías RTClib y DS3231, pero esa no y tampoco la encuentro con Google.

Saludos

@anon90500195 gracias por la respuesta modifique un poco el codigo, lo de rtc_ds3231 creo que quedo de un intento anterior logre compilarlo con la libreria rtclib aqui adjunto el codigo completo pero no logro ver nada por serial asi que no puedo ver si esta imprimiendo bien, sabes porque puede ser? la velocidad de los baudios tal vez?

#include "RTClib.h"
RTC_DS3231 rtc;
DateTime now = rtc.now();
DateTime dt(now.year(), 6, 8, 14,39, 0);
DateTime t1 (now.year(),7,14,8,0,0);           //2018-7-14 8:00:00
          //2018-7-14 18:00:00 
//Calculos 1


void setup() {
 
    Serial.begin(9600); 

  rtc.begin();
 
 
}
void loop() {
 DateTime now = rtc.now();
TimeSpan t3 = dt - t1;
//Mostrar

Serial.println(t3.days());     
Serial.println("d"); //0
Serial.println(t3.hours()); 
Serial.println(":"); //10
Serial.println(t3.minutes());
Serial.println(":"); //0
Serial.println(t3.seconds());               //0
}

Imagino que si, que tienes mal la velocidad del terminal porque otra cosa no encuentro, fíjate que también esté en 9600 bps.

saludos

Prueba esto a ver si funciona.

#include "RTClib.h"
RTC_DS3231 rtc;
DateTime now = rtc.now();
DateTime dt(now.year(), 6, 8, 14, 39, 0);
DateTime t1 (now.year(), 7, 14, 8, 0, 0);      //2018-7-14 8:00:00
//2018-7-14 18:00:00
//Calculos 1

void showDate(const char* txt, const DateTime& dt) {
    Serial.print(txt);
    Serial.print(' ');
    Serial.print(dt.year(), DEC);
    Serial.print('/');
    Serial.print(dt.month(), DEC);
    Serial.print('/');
    Serial.print(dt.day(), DEC);
    Serial.print(' ');
    Serial.print(dt.hour(), DEC);
    Serial.print(':');
    Serial.print(dt.minute(), DEC);
    Serial.print(':');
    Serial.print(dt.second(), DEC);

    Serial.print(" = ");
    Serial.print(dt.unixtime());
    Serial.print("s / ");
    Serial.print(dt.unixtime() / 86400L);
    Serial.print("d since 1970");

    Serial.println();
}

void showTimeSpan(const char* txt, const TimeSpan& ts) {
    Serial.print(txt);
    Serial.print(" ");
    Serial.print(ts.days(), DEC);
    Serial.print(" days ");
    Serial.print(ts.hours(), DEC);
    Serial.print(" hours ");
    Serial.print(ts.minutes(), DEC);
    Serial.print(" minutes ");
    Serial.print(ts.seconds(), DEC);
    Serial.print(" seconds (");
    Serial.print(ts.totalseconds(), DEC);
    Serial.print(" total seconds)");
    Serial.println();
}

void setup() {
  delay(2000);
  Serial.begin(9600);
  Serial.println("Inicio dif datetime");
  //rtc.begin();
}
void loop() {
  DateTime now = rtc.now();
  showDate("dt:", dt);
  showDate("t1:", t1);
  TimeSpan t3 = dt - t1;
  showTimeSpan("t3:", t3);
}


REALIZE UNAS MODIFICACIONES AL CODIGO Y OBTUBE LA RESTA DELA FECHAS EN TIEMPO REAL ESPERO Y SEA DE AYUDA

dia_nuevo.ino (2,1 KB)

Moderador:
Bienvenido #colatronik al Foro Arduino en Español.
Por favor, lee las Normas del foro y edita tu post usando minúsculas. hablo del post#6 no de que reescribas en otro post como muchos hacen.
Tu código debe verse, no simplemente adjuntarse como has hecho. Este foro permite tamaños grandes asi que no hay excusas para postearlo debidamente. Te dejo como se edita, pero lee las normas.
Ve a edición, luego selecciona todo el error que has publicado, lo cortas y click en </>


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.