// TM1037 SevenSegment Counter Wokwi Example
//
// https://wokwi.com/projects/339227323398095442

#include <TM1637.h>

const int CLK = 2;
const int DIO = 3;
const int buttonPin = 5;
bool buttonState=LOW;
TM1637 tm(CLK, DIO);

void setup() {
  tm.init();
  tm.set(BRIGHT_TYPICAL);
  pinMode(buttonPin, INPUT);
}

unsigned int counter = 0;

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(10);
}
4-Digit Display