The project aims to collect data from RTC clock and display it using LCD
LCD Display
Arduino UNO
RTC Clock
Jumper wires
Arduino IDE
Develop the circuitr by making connections as shown above.
Code
void setup()
{
lcd.init();
lcd.backlight();
Serial.begin(
9600);
Wire.begin();
DS3231_init(DS3231_INTCN);
t.hour=
8;
t.min=
30;
t.sec=
0;
t.mday=
23;
t.mon=
12;
t.year=
2019;
DS3231_set(t);
if(t.hour<
13){
if(t.hour>
0){
lcd.setCursor(
3,
0);
lcd.print(
"Good Morning !");
}
}
if(t.hour<
23){
if(t.hour>
19){
lcd.setCursor(
4,
0);
lcd.print(
"Good Night !");
}
}
if(t.hour<
20){
if(t.hour>
12){
lcd.setCursor(
2,
0);
lcd.print(
"Good Afternoon !");
}
}
}
void loop(){
DS3231_get(&t);
lcd.setCursor(
6,
2);
lcd.print(t.hour);
lcd.setCursor(
8,
2);
lcd.print(
":");
lcd.setCursor(
9,
2);
lcd.print(t.min);
lcd.setCursor(
11,
2);
lcd.print(
":");
lcd.setCursor(
12,
2);
lcd.print(t.sec);