#include <TM1637Display.h>
#include <RTClib.h>
int CLK = 7;
int DIO = 6;
unsigned long long time;
RTC_DS1307 rtc;
TM1637Display tm(CLK, DIO);
TM1637Display tm2(CLK - 2, DIO - 2);
TM1637Display tm3(CLK - 4, DIO - 4);
void setup() {
rtc.begin();
tm.setBrightness(4);
tm2.setBrightness(4);
tm3.setBrightness(4);
}
bool check = false;
void loop() {
time = millis();
tm.showNumberDecEx((time / 60000) * 100 + (time / 1000 % 60), 0b11100000, true, 4, 0);
if (99 - (time / 1000) > 0 && check == false) {
tm2.showNumberDecEx(9999 - time / 10, 0b11100000, true, 4, 0);
} else if (99 - time / 1000 == 0) {
tm2.showNumberDecEx(0, 0b11100000, true, 4, 0);
check = true;
}
int thoigian = int(rtc.now().hour());
tm3.showNumberDecEx(int(thoigian), 0b11100000, true, 2, 0);
tm3.showNumberDecEx(int(rtc.now().minute()), 0b11100000, true, 2, 2);
}