I want to make a hydroponic project that can count down the harvest day using RTC and display it on LCD, and I'm having a problem on the program. The LCD will display others thing like nutrition and Ph but I'm having a problem on the day countdown only. Like I'm stuck? Anyway here's the program. Please help, thank you!
You can calculate the difference between 2 dates by using rtc.unixtime(). This returns a date & time as a number of seconds. Do this to the current date and your harvest date, subtract one from the other and divide by the number of seconds in a day.
Each forum section/category has a sticky post at the top "About the XYZ Category" which explains what type of questions are appropriate there. This will help you choose the best forum section for your question.
Oh. Maybe you are not using the library I thought. How did you install the DS3231 library? From Library Manager or a .zip file? Which one is it, because there are more than one DS3231 library available I think.
@anon57585045 if there is more than 1 DS3231 library installed, I know that the compiler will make a decision about which one to use. Is there a way to specify/qualify which one you want it to use? (Other than un-installing all but one of them.)
In the case of the Adafruit library, the include file is not named DS3231.h, so if some DS3231.h were installed, the compiler would not even look for it. This is from one of my sketches:
I don't know how to select/deselect identically named library files, I just try to avoid it. I have two main sketch folders, one is a "working" and one is an "archive" folder. If there was a conflict, I would just move one I don't want to use to the archive folder, manually.
I think this is the library your sketch was written to use, because, among other clues, it uses a function .getDateString() which that library has but other DS3231 libraries (including the one you posted a link to) do not have.
This Rinky-Dink library's main page says
IMPORTANT:
The library has not been tested in combination with the Wire library and I have no idea if they can share pins. Do not send me any questions about this.
For this reason, I would suggest you stop using this library, unless there is some reason you must use it.
I recommend you uninstall all your DS3231 libraries, then install one of those recommended by @anon57585045 using the Library Manager, if possible.
Have a look at the example sketches that come with the new library and adapt your sketch to use the same functions.
If you get stuck, post your updated code and the error messages you see.