Skip to content

clearAlarm()

Arnd edited this page Dec 12, 2020 · 2 revisions

This function is called to reset the state of the alarm queried with isAlarm() and set with setAlarm(). The flag is also cleared when a new alarm is set.


Example:

...
DS3231M_Class DS3231M; // Create an instance of the DS3231M
...
void setup() {
  Serial.begin(SERIAL_SPEED);
  while (!DS3231M.begin()) { // Initialize RTC communications
    Serial.println("Unable to find DS3231M. Checking again in 1 second.");
    delay(1000);
  } // of loop until device is located
 uint8_t alarmType;
 DS3231M.setAlarm(secondsMinutesHoursDateMatch,DateTime(2017,8,5,18,30,0)); // 18:30:00 on 2017-08-05
 while (!DS3231M.isAlarm()); // loop until the alarm is triggered
 DS3231M.clearAlarm(); // Turn off the alarm
...
Clone this wiki locally