0% found this document useful (0 votes)
5 views1 page

Arduino RTC with I2C LCD Display Code

Uploaded by

ayyubagnd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Arduino RTC with I2C LCD Display Code

Uploaded by

ayyubagnd
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd

#include <Wire.

h>
#include <LiquidCrystal_I2C.h>
#include "RTClib.h" // library yang kita add tadi
LiquidCrystal_I2C lcd(0x3f, 16, 2); // alamat i2c lcd dan type lcd 16x2

RTC_DS3231 rtc;
char hari[7][12] = {"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"};

void setup() {
[Link]();
[Link]();

if ([Link]()) {
[Link](DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop() {
DateTime now = [Link]();
[Link](1,0);
[Link](hari[[Link]()]);
[Link](":");
printDT([Link]());
[Link]("-");
printDT([Link]());
[Link]("-");
printDT([Link]());

[Link](4,1);
printDT([Link]());
[Link](":");
printDT([Link]());
[Link](":");
printDT([Link]());
delay(500);
}
void printDT ( int DT ){
if ( DT < 10 ){
[Link]('0');
[Link](DT);
}
else{
[Link](DT);
}
}

You might also like