#include <Wire.h>
#include <RTClib.h>
#include <TM1637Display.h>
RTC_DS3231 rtc;
TM1637Display display(7,3);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, let's set the time!");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
display.setBrightness(0x0f);
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
int hour = now.hour();
int minute = now.minute();
display.showNumberDecEx(hour * 100 + minute, 0b11100000, true);
delay(1000);
}