JChristensen DS3232RTC library sleep time

Hi,

I use this library > GitHub - JChristensen/DS3232RTC: Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks and works perfectly to sleep and wake up my arduino (with pull-up resistor)..

It's possible to make an alarm two in two hours?

Lib possibilities:

ALM1_EVERY_SECOND -- causes an alarm once per second.
ALM1_MATCH_SECONDS -- causes an alarm when the seconds match (i.e. once per minute).
ALM1_MATCH_MINUTES -- causes an alarm when the minutes and seconds match.
ALM1_MATCH_HOURS -- causes an alarm when the hours and minutes and seconds match.
ALM1_MATCH_DATE -- causes an alarm when the date of the month and hours and minutes and seconds match.
ALM1_MATCH_DAY -- causes an alarm when the day of the week and hours and minutes and seconds match.

What is the difference between:

alarm(ALM1_MATCH_SECONDS,5,0,0,0)
alarm(ALM1_MATCH_MINUTES,5,0,0,0)
alarm(ALM1_MATCH_HOURS,5,0,0,0)

?

Best Regards

It's possible to make an alarm two in two hours?

What do you mean exactly? Trigger something in 2 hours?

J-M-L:
What do you mean exactly? Trigger something in 2 hours?

0h00 > wake up ... read sensores .. transmit and sleep...

2h00 > wake up ... read sensores .. transmit and sleep...

4h00 > wake up ... read sensores .. transmit and sleep...

6h00 > wake up ... read sensores .. transmit and sleep...

8h00 > wake up ... read sensores .. transmit and sleep... :slight_smile:

You cannot set an alarm every two hours like you want.

But you can set an alarm every hour:

RTC.setAlarm( ALM1_MATCH_MINUTES, 0, 0, 0, 0 );

then when the alarm is triggered, check if the hour is even:

if ( alarm( ALARM_1 ) )
{
  if ( ( hour & 1 ) == 0 ) // if hour is even
  {
    // do something every two hours
  }
}

:slight_smile:

guix:
You cannot set an alarm every two hours like you want.

But you can set an alarm every hour:

RTC.setAlarm( ALM1_MATCH_MINUTES, 0, 0, 0, 0 );

then when the alarm is triggered, check if the hour is even:

if ( alarm( ALARM_1 ) )

{
  if ( ( hour & 1 ) == 0 ) // if hour is even
  {
    // do something every two hours
  }
}

good idea :wink:

Another way to do is to trigger the alarm and assign 00:00:00 on the clock

:slight_smile: