i am learning how to use RTC for different time functions (DS1307, DS3231). I want to make on/off delay timer based on RTC but i don't know how.
I want to have 5 seconds delay before turn led on or off, after switch is pressed. I took code from previous project, based on millis() and change it so i can use RTC seconds but after rollover, it stops working. I understand why but i don't know how to fix it.
I can't find any good tutorials to learn how to use different RTC time functions.
Current code idea..
delayTime = 5; // 5 seconds
if ((switch == HIGH) && (now.second() - onTime >= delayTime))
offTime = now.second();
else if ((switch == LOW) && (now.second() - offTime >= delayTime))
onTime = now.second();
I also tried to play a little with futureTime function, which i found but i didn't know how to use it. I would really appreciate any help or turorial link about handling RTC functions.