-
Notifications
You must be signed in to change notification settings - Fork 6
pinSquareWave()
Arnd edited this page Dec 12, 2021
·
3 revisions
This function sets the "INT/SQW" pin on the DS3231M to output a 1Hz square wave. This disables the setting of pinAlarm(). {Update Version 1.0.7} This function now accepts an optional parameter, "rate". If not used it works as before, setting a 1Hz square wave output on both the DS3231M and the DS3231 chips. If the "rate" is specified for the DS3231M it always sets a 1Hz signal, but on the DS3231 it will set the output to the following values:
Value | Rate |
---|---|
0 | 1Hz |
1 | 1.024kHz |
2 | 2.048kHz |
3 | 4.096kHz |
...
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.pinSquareWave();
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
...