Skip to content

pinAlarm()

Arnd edited this page Dec 12, 2020 · 3 revisions

This function sets the "INT/SQW" pin on the DS3231M to pull high when an alarm goes off. The flag in isAlarm() will still be set when the alarm is triggered. If pinSquareWave was set that functionality is turned off by this call.


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.pinAlarm();
 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