#include "Arduino.h"
#include "uRTCLib.h"
#include "LiquidCrystal_I2C.h"

// uRTCLib rtc;
uRTCLib rtc(0x68);
LiquidCrystal_I2C lcd(0x27,16,2);

char daysOfTheWeek[7][12] = {"Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"};

void setup() {
  lcd.begin(16,2);
  lcd.backlight();
   // wait for console opening

 
  URTCLIB_WIRE.begin();

  // Comment out below line once you set the date & time.
  // Following line sets the RTC with an explicit date & time
  // for example to set January 13 2022 at 12:56 you would call:
   rtc.set(0, 56, 12, 5, 13, 1, 22);
  // rtc.set(second, minute, hour, dayOfWeek, dayOfMonth, month, year)
  // set day of week (1=Sunday, 7=Saturday)
}

void loop() {
  rtc.refresh();

  //Serial.print("Current Date & Time: ");
  lcd.setCursor(0,1);
  lcd.print(rtc.year());
  lcd.print('/');
  lcd.print(rtc.month());
  lcd.print('/');
  lcd.print(rtc.day());

  lcd.print(" (");
  lcd.print(daysOfTheWeek[rtc.dayOfWeek()-1]);
     lcd.print(") ");
   lcd.setCursor(0,0);

  
  lcd.print(rtc.hour());
  lcd.print(':');
  lcd.print(rtc.minute());
  lcd.print(':');
  lcd.println(rtc.second());
  
  delay(1000);
}
GND5VSDASCLSQWRTCDS1307+