#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
RTC_DS3231 RTC_tkb;
LiquidCrystal_I2C lcd_tkb(0x27, 16, 2);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
RTC_tkb.begin();
RTC_tkb.adjust(DateTime(F(__DATE__), F(__TIME__)));
lcd_tkb.init();
lcd_tkb.backlight();
lcd_tkb.setCursor(0,0);
lcd_tkb.print("Teknik Komputer");
lcd_tkb.setCursor(2,1);
lcd_tkb.print("Join Kelas B");
delay(5000);
lcd_tkb.clear();
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = RTC_tkb.now();
int tahun = now.year();
int bulan = now.month();
int tanggal = now.day();
int jam = now.hour();
int menit = now.minute();
int detik = now.second();
// Baris 1 ==> Tahun: tahun/bulan/tanggal
lcd_tkb.setCursor(0,0);
lcd_tkb.print("Tahun: ");
lcd_tkb.print(tahun);
lcd_tkb.print("/");
lcd_tkb.print(bulan);
lcd_tkb.print("/");
lcd_tkb.print(tanggal);
// Baris 2 ==> waktu: jam:menit/detik
lcd_tkb.setCursor(0,1);
lcd_tkb.print("Waktu: ");
lcd_tkb.print(jam);
lcd_tkb.print(":");
lcd_tkb.print(menit);
lcd_tkb.print(":");
lcd_tkb.print(detik);
Serial.println(tahun);
delay(1000);
}