Question about RTC function library

Hello guys,

I am very new to Arduino stuff and I am having trouble with RTC. I am setting up a automatic greenhouse. In the process I want to press a button, when this button is pressed the date will be saved and it starts counting 2 weeks in time from "now". I cant seem to find a library that has a function for this job and I cant figure it out. If any of u guys know how to make it work please leave your suggestion here.

Im using the library "RTC".

if you use adafruit/RTClib there are a DateTime and TimeSpan classes that could make your life easy.

have a look at their datecalc.ino example

1 Like

Hey thanks, I will take a look right now.

There's a problem now im using the RTClib but keep having and error

I cant write on the loop don't understand why, for me it being on setup won't work cause i need it to be constantly verifying conditions.

Move your declaration for dt20 so that it's not inside the function where it's first used. It's not in scope in loop().

1 Like

What RTC are you using? You want to find a library directly for the RTC you have.