#include <TM1637Display.h>
// Definir los pines CLK y DIO para el TM1637
#define CLK 4
#define DIO 5
TM1637Display display(CLK, DIO);
// Duración del temporizador en segundos (1 hora = 3600 segundos)
unsigned long timerDuration = 3600;
unsigned long previousMillis = 0;
const long interval = 1000; // Intervalo de 1 segundo
void setup() {
display.setBrightness(0x0f); // Ajustar el brillo del display
display.showNumberDecEx(0, 0b01000000, true, 4, 0); // Mostrar "00:00" al inicio
}
void loop() {
unsigned long currentMillis = millis();
// Verificar si ha pasado un segundo
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
if (timerDuration > 0) {
timerDuration--;
}
// Convertir el tiempo restante a minutos y segundos
int minutes = timerDuration / 60;
int seconds = timerDuration % 60;
// Mostrar el tiempo restante en el display
display.showNumberDecEx(minutes * 100 + seconds, 0b01000000, true, 4, 0);
}
}