Time not getting updated in Tiny Rtc Module and Arduino Nano

Hi, I am trying to get just the time using TINY RTC MODULE which uses ds1307 ic, with simple wiring and simple program let me give you details and time is not getting updated, once it initializes the system time the same is repeated again and again and doesn't get changed,

wiring,
tiny rtc SDA - Nano(A4)
tiny rtc SCL - Nano(A5)
tiny rtc GND - Nano(GND)
tiny rtc VCC - Nano(5V)

CODE `//DateTime (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec)

//#include
#include "RTClib.h"

#define alarmPin 2

const int alarm[] = {2019, 6, 14, 22, 17, 0};
const int waitTime = 4000;

RTC_DS1307 rtc;

void setup () {
pinMode(alarmPin, OUTPUT); //set pin 2 as output

while (!Serial); // for Leonardo/Micro/Zero

Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}

if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");

}
rtc.adjust(DateTime(F(DATE), F(TIME)));
}

void loop () {

DateTime royal = rtc.now();

Serial.println();
Serial.print("Time: ");
Serial.print(royal.year(), DEC);
Serial.print("-");
Serial.print(royal.month(), DEC);
Serial.print("-");
Serial.print(royal.day(), DEC);
Serial.print("-");
Serial.print(royal.hour(), DEC);
Serial.print("-");
Serial.print(royal.minute(), DEC);
Serial.print("-");
Serial.print(royal.second(), DEC);
Serial.println();
delay(500);

}`
AND THE OUTPUT I RECEIVE IS THIS

WHAT MIGHT BE THE ISSUE? CAN YOU PLEASE HELP ME?

Hi.
try to paste the code with </> button

What was the initial output on your serial monitor? If your RTC is not running, it would have displayed that message. Did you see that?

My guess is that it is not running

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