#include "SPI.h"
#include "Adafruit_ILI9341.h"
#include "RTClib.h"
// Enrico William A. Sihotang_A022008
#define DC 9
#define CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(CS, DC);
RTC_DS1307 rtc;
char hari[7][6] = {"Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"};
void setup () {
Serial.begin(9600);
tft.begin();
tft.setCursor(30, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.println("Enrico William A. Sihotang");
tft.setCursor(60, 160);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(3);
tft.println("A022008");
if (! rtc.begin()) {
Serial.println("Menghubungi RTC");
Serial.flush();
abort();
}
}
void loop () {
DateTime now = rtc.now();
Serial.print("Waktu: ");
Serial.print(now.year());
Serial.print('/');
Serial.print(now.month());
Serial.print('/');
Serial.print(now.day());
Serial.print(" (");
Serial.print(hari[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour());
Serial.print(':');
Serial.print(now.minute());
Serial.print(':');
Serial.print(now.second());
Serial.println();
Serial.println();
delay(1000);
}