brice3010:
- In post #7 in setup you need to change the RTC ALM1 to minutes, not seconds: RTC.setAlarm(ALM1_MATCH_MINUTES, 00, 00, 0, 0);
- Then, there in the loop, while woken up, currently the new "wakes" are set at 5 minutes past the hour.
The loop is written so that you get back to sleep, to the end of void loop(){}
If you want to wait for one minute before going to sleep after wake-up, insert a timer with this delay.
I have tried to change something like you mentioned . can you please check.
i want device to wake up every 5 hours and goes sleep after 2 minutes.
i am new to this trying my best to understand can you help me in changes with the code
#include <DS3232RTC.h>
#include <Wire.h>
DS3232RTC rtc;
void setup()
{
Serial.begin( 115200 );
Wire.begin();
rtc.alarm( ALARM_1 ); // makes sure A1F is cleared (see datasheet p.14)
rtc.setAlarm(ALM1_MATCH_MINUTES, 00, 00, 0, 0);
}
void loop()
{
if ( rtc.alarm( ALARM_1 ) )
{
tmElements_t tm;
rtc.read( tm );
RTC.setAlarm(ALM1_MATCH_MINUTES, 0, (tm.Minute + 20) % 60, 0, 0);
time_t now = makeTime( tm );
Serial.println( now );
}
}