-
Notifications
You must be signed in to change notification settings - Fork 6
weekdayWrite()
Arnd edited this page Dec 12, 2020
·
2 revisions
Function sets the value of the DS3231M's day-of-week setting to a number between 1 and 7, values outside of this range are ignored. This value is user-settable and is set by default in the adjust() function to a value for the date where Monday equates to 1 and Sunday equates to 7. The value can be read using weekdayRead(). Changing this value doesn't affect the RTC's DateTime value as the day-of-week is not used in any calculations.
...
DS3231M_Class DS3231M; // Create an instance of the DS3231M
...
DS3231M.adjust(DateTime(2017,07,23,12,0,0)); // Set clock to 2017-07-23 12:00:00
DS3231M.weekdayWrite(3); // set the day of week to Wed, even though it is Sun
Serial.print("Day of week in RTC for 2017-07-23 is ");
Serial.println(DS3231M.weekdayRead());
...