JChristensen / DS3232RTC

Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks
GNU General Public License v3.0
392 stars 135 forks source link

How to set an alarm every two days? #100

Closed anrada73 closed 2 years ago

anrada73 commented 2 years ago

Nice library, thanks. How is it possible to easily turn on the alarm at a given time in 1 or 2 days?

JChristensen commented 2 years ago

The technique would be the same as the example sketch alarm_ex3, except when setting the alarm, use ALM1_MATCH_DATE instead of ALM1_MATCH_HOURS.

anrada73 commented 2 years ago

You mean ALARM_INTERVAL ? If in a day, then set to 86.400 seconds?

JChristensen commented 2 years ago

I mean:

myRTC.setAlarm(DS3232RTC::ALM1_MATCH_DATE, second, minute, hour, date);

Edit: And yes, ALARM_INTERVAL would be one day, or two days, or whatever you prefer. In seconds, so yes 86,400 sec/day.

seamusdemora commented 2 years ago

Think of it as cron-Arduino-style :)