#include "mbed.h"
#include "TM1637.h" // Ensure you have a TM1637 library added
// Define Pins
TM1637 display(D15, D14); // CLK, DIO
InterruptIn button(D13); // Button pin
int count = 0;
// Function called when button is pressed
void increment() {
count++;
if (count > 9999) count = 0; // Reset if it exceeds 4 digits
}
int main() {
display.setBrightness(7); // Set brightness (0-7)
button.rise(&increment); // Trigger increment on rising edge
while (true) {
display.showNumber(count);
ThisThread::sleep_for(100ms); // Small delay for stability
}
}