05-06-2023, 01:09 AM
[Arduino source code for KC868-A32M]-01_DS3231_RTC
Code:
// KC868-A32M RTC CODE DS3231
#include <Wire.h>
#include "RTClib.h"
#define SDA 4
#define SCL 5
RTC_DS3231 myRTC;
void setup () {
Serial.begin(115200);
Wire.begin(SDA,SCL);
delay(500);
myRTC.begin();
myRTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
void loop () {
DateTime now = myRTC.now();
Serial.printf("%02d/%02d/%02d %02d:%02d:%02d\n",
now.year(),
now.month(),
now.day(),
now.hour(),
now.minute(),
now.second());
delay(1000);
}