#include <Wire.h>
#include <RTClib.h>
#include <SevSeg.h>
RTC_DS1307 rtc;
SevSeg sevseg;
void setup() {
Serial.begin(9600);
Wire.begin();
rtc.begin();
// Konfigurasi perangkat keras 7-Segment Display
byte numDigits = 4;
byte digitPins[] = {2, 3, 4, 5};
byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
bool resistorsOnSegments = false; // false untuk common anoda display
bool updateWithDelaysIn = true;
byte hardwareConfig = COMMON_ANODE; // common anoda
bool leadingZeros = false; // no leading zeros in the display
bool disableDecPoint = false;
sevseg.begin(
hardwareConfig, numDigits, digitPins, segmentPins,
resistorsOnSegments, updateWithDelaysIn, leadingZeros, disableDecPoint);
if (!rtc.isrunning()) {
// Set the time if the RTC is not running
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
Serial.println("KELOMPOK B7 KEREN"); delay(6000);
Serial.println("ANJAY MABAR"); delay(6000);
}
void loop() {
DateTime now = rtc.now();
int hour = now.hour();
int minute = now.minute();
// Display the time on the 7-Segment Display
int timeToDisplay = (hour * 100) + minute;
//int disableDecPoint = ("true");
sevseg.setNumber(timeToDisplay, 2); // 2 decimal places
sevseg.refreshDisplay();
//Serial.println(disableDecPoint);
Serial.print("Pukul :");
Serial.println(timeToDisplay);
delay(10);
}