#include <Wire.h>
#include <RTClib.h>
#include <TM1637Display.h>
#define CLK 8
#define DIO 9
RTC_DS1307 rtc;
TM1637Display display(CLK, DIO);
void setup() {
Serial.begin(9600);
Wire.begin();
if (!rtc.begin()) {
Serial.println("RTC not detected!");
while (1);
}
// You can remove the lostPower() check and the time adjustment here
display.setBrightness(0x0f); // Set brightness to maximum
}
void loop() {
DateTime now = rtc.now();
int displaytime = now.hour() * 100 + now.minute();
Serial.println(displaytime);
display.showNumberDec(displaytime, false);
delay(1000);
}