- Iniciador del tema
- #41
Lo he vuelto a compilar el codigo del reloj y luego tu codigo. Este es el codigo del reloj que uso:
PRIMER PASO
#include <Wire.h> // Incluye la librería Wire
#include "RTClib.h" // Incluye la librería RTClib
RTC_DS1307 RTC; // Crea el objeto RTC
void setup () {
Serial.begin(9600); // Establece la velocidad de datos del puerto serie
Wire.begin(); // Establece la velocidad de datos del bus I2C
RTC.begin(); // Establece la velocidad de datos del RTC
}
void loop () {
DateTime now = RTC.now(); // Obtiene la fecha y hora del RTC
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000); // La información se actualiza cada 1 seg.
}
SEGUNDO PASO
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__, __TIME__));
} void loop () { }
TERCER PASO
Vuelvo a copiar el primer codigo.
Ahora lo apagare y vere a ver si se retrasa.
Un saludo!
PRIMER PASO
#include <Wire.h> // Incluye la librería Wire
#include "RTClib.h" // Incluye la librería RTClib
RTC_DS1307 RTC; // Crea el objeto RTC
void setup () {
Serial.begin(9600); // Establece la velocidad de datos del puerto serie
Wire.begin(); // Establece la velocidad de datos del bus I2C
RTC.begin(); // Establece la velocidad de datos del RTC
}
void loop () {
DateTime now = RTC.now(); // Obtiene la fecha y hora del RTC
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000); // La información se actualiza cada 1 seg.
}
SEGUNDO PASO
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
void setup () {
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__, __TIME__));
} void loop () { }
TERCER PASO
Vuelvo a copiar el primer codigo.
Ahora lo apagare y vere a ver si se retrasa.
Un saludo!