dvalero484
Junior Member level 1

Hello everyone.
I'm working on an automatic irrigation system using Arduino Mega 2560, TFT screen ILI9488, RTC module DS3231 and a KY-023 joystick module in a physical assembly. The problem is that the RTC doesn't keep the correct time. When the system is turned on, it starts to lag by seconds after a few minutes. The longer it is on, the more it is delayed.
I have already posted about this (https://www.edaboard.com/threads/rt...and-doesnt-keep-the-correct-time-pace.413832/) and I was recommended to run the RTC with interrupts. I haven't worked with interrupts in Arduino before, so I followed a video:
Anyways, I tried interrupts, but as I said, it's my first time working with interrupts in Arduino, so I probably didn't do it right.
I'm attaching the code. I'd be grateful if you could tell me what's wrong with it and give me some tips on how to fix it. Thanks in advance.
Note: I'll also attach the code example I used for interrupts.
I'm working on an automatic irrigation system using Arduino Mega 2560, TFT screen ILI9488, RTC module DS3231 and a KY-023 joystick module in a physical assembly. The problem is that the RTC doesn't keep the correct time. When the system is turned on, it starts to lag by seconds after a few minutes. The longer it is on, the more it is delayed.
I have already posted about this (https://www.edaboard.com/threads/rt...and-doesnt-keep-the-correct-time-pace.413832/) and I was recommended to run the RTC with interrupts. I haven't worked with interrupts in Arduino before, so I followed a video:
Anyways, I tried interrupts, but as I said, it's my first time working with interrupts in Arduino, so I probably didn't do it right.
I'm attaching the code. I'd be grateful if you could tell me what's wrong with it and give me some tips on how to fix it. Thanks in advance.
Note: I'll also attach the code example I used for interrupts.