Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino source code for KC868-A32M]-01_DS3231_RTC
#1
[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);
   

   
}


Attached Files
.zip   KC868-A32M_DS3231_RTC.zip (Size: 689 bytes / Downloads: 134)
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)