Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alarm 2 settings needs to be corrected, no seconds #15

Open
Eheran1 opened this issue Sep 23, 2017 · 2 comments
Open

Alarm 2 settings needs to be corrected, no seconds #15

Eheran1 opened this issue Sep 23, 2017 · 2 comments

Comments

@Eheran1
Copy link

Eheran1 commented Sep 23, 2017

This is out of the "alarm" example and will not work, see below for the working example. It took me way too long to figure that one out: There can not be any seconds with Alarm2.

  // Set Alarm - Every full minute.
  // DS3231_EVERY_MINUTE is available only on Alarm2.
  // setAlarm2(Date or Day, Hour, Minute, Second, Mode, Armed = true)
   clock.setAlarm2(0, 0, 0, 0, DS3231_EVERY_MINUTE);
  // Set Alarm - Every full minute.
  // DS3231_EVERY_MINUTE is available only on Alarm2.
  // setAlarm2(Date or Day, Hour, Minute, Mode, Armed = true)
   clock.setAlarm2(0, 0, 0, DS3231_EVERY_MINUTE);
@rjaraman21
Copy link

I'm Sorry that I can't anything to this post because I'm new at this and having ALOT of trouble finding simple examples or anyone knowing how to set a simple alarm.
Everyone can tell me how to set the ds3231 clock, but not how to make a pin go high at 3;30 every Wednesday. Very frustrating. I have a watch for telling time, Hope the ds3231 can do more than that.

@Eheran1
Copy link
Author

Eheran1 commented Oct 20, 2017

This example really did not help you?

// Set Alarm - 10h:45m:30s in every Friday (1 - Mon, 7 - Sun)
// setAlarm1(Date or Day, Hour, Minute, Second, Mode, Armed = true)
// clock.setAlarm1(5, 10, 40, 30, DS3231_MATCH_DY_H_M_S);

By the way, since this library is not maintaned i switched to https://github.com/JChristensen/DS3232RTC. But doing a alarm is actually a little harder with that one as well as printing the time... so if there is no need maybe stick with this one?
I dont know how to set a day of the week there, but this is every second + Pin high. I think you have to call "RTC.alarm(ALARM_1);" every time you want the pin to go low again. But maybe that is just for the "software" flag that there has been a alarm. There is no need to use the pin as long as you can communicate, you still see the alarms, you only really need the pin for wakeup etc.

  RTC.setAlarm(ALM1_EVERY_SECOND, 0, 0, 0, 1);    //daydate parameter should be between 1 and 7
  RTC.alarm(ALARM_1);                   //ensure RTC interrupt flag is cleared
  RTC.alarmInterrupt(ALARM_1, true); //pin goes high

Software check (and clear flag) if alarm happened:

    if (RTC.alarm(ALARM_1)) {
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants