Modulo RTC DS1307
$ 5.700
Impuestos incluidos
El DS1307 es un módulo RTC (reloj de tiempo real) con calendario de nuestro año actual hasta el año 2100; tiene en cuenta los años bisiestos. Su protocolo de comunicación es el I2C, puede trabajar como contador de segundos con el pin SQ. Además trae una memoria EEPROM AT24C32 con una capacidad de 32Kbit y un holder de bateria CR2032.
Características:
Detalles del producto
-
ReferenciaSEN-0171
-
En stock48 Artículos
-
EstadoNuevo
-
ean135053212001711
#include <RTClib.h> #include <Wire.h> // RTC_DS1307 rtc; RTC_DS3231 rtc; String daysOfTheWeek[7] = { "Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado" }; String monthsNames[12] = { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre" }; void setup() { Serial.begin(9600); delay(1000); if (!rtc.begin()) { Serial.println(F("Couldn't find RTC")); while (1); } // Si se ha perdido la corriente, fijar fecha y hora if (rtc.lostPower()) { // Fijar a fecha y hora de compilacion rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // Fijar a fecha y hora específica. En el ejemplo, 21 de Enero de 2016 a las 03:00:00 // rtc.adjust(DateTime(2016, 1, 21, 3, 0, 0)); } } void printDate(DateTime date) { Serial.print(date.year(), DEC); Serial.print('/'); Serial.print(date.month(), DEC); Serial.print('/'); Serial.print(date.day(), DEC); Serial.print(" ("); Serial.print(daysOfTheWeek[date.dayOfTheWeek()]); Serial.print(") "); Serial.print(date.hour(), DEC); Serial.print(':'); Serial.print(date.minute(), DEC); Serial.print(':'); Serial.print(date.second(), DEC); Serial.println(); } void loop() { // Obtener fecha actual y mostrar por Serial DateTime now = rtc.now(); printDate(now); delay(3000); }