EasyManua.ls Logo

AZ-Delivery DS3231 - Sketch Example

AZ-Delivery DS3231
32 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Sketch example
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
};
void setup () {
Serial.begin(9600);
delay(2000);
rtc.begin();
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
/* To manualy set date and time,
remove the coment // signs
and enter new values in the followingline
in this sequence: year, day, month, hour, minute and second.*/
//rtc.adjust(DateTime(2020, 2, 24, 10, 00, 0));
}
void loop () {
DateTime now = rtc.now();
//Day of the week
Serial.print("Day of the week: ");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.println();
- 14 -