-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRTC_Unit_Test.ino
37 lines (28 loc) · 880 Bytes
/
RTC_Unit_Test.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "RTCds3231Settings.h"
#include <ArduinoJson.h>
#include <LiquidCrystal_I2C.h>
//LCD Display
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);
StaticJsonDocument<200> doc;
void setup(){
Wire.begin();
Serial.begin(9600);
// set the initial time here:
// DS3231 seconds, minutes, hours, day, date, month, year
setDS3231time(30,11,10,5,30,6,23);
lcd.init();
lcd.clear();
lcd.backlight();
}
void loop(){
String dateTime = displayDateTime(); // display the real-time clock data on the Serial Monitor,
deserializeJson(doc, dateTime);
String date=doc["date"];
String time=doc["time"];
Serial.println(date+" "+time);
delay(1000); // every second
lcd.setCursor(0,0); //Move cursor to character 2 on line 1
lcd.print("DateTime:");
lcd.setCursor(0,1); //Move cursor to character 2 on line 1
lcd.print(date+" "+time);
}