#include <TM1637.h>
const int CLK = 2;
const int DIO = 3;
const int buttonPin = 5;
bool buttonState=LOW;
int counter = 0;
TM1637 tm(CLK, DIO);
void setup() {
tm.init();
tm.set(BRIGHT_TYPICAL);
pinMode(buttonPin, INPUT);
}
void loop() {
tm.display(0, (counter / (10*10*10)) % 10);
tm.display(1, (counter / (10*10)) % 10);
tm.display(2, (counter / 10) % 10);
tm.display(3, counter % 10);
buttonState=digitalRead(buttonPin);
if(buttonState)
counter++;
if (counter == 10*10*10*10) {
counter = 0;
}
delay(100);
}