// TM1637 SevenSegment Counter Wokwi Example
//
// https://wokwi.com/projects/339227323398095442
#include <TM1637.h>
const int CLK = 2;
const int DIO = 3;
bool button=true;
int counterM=0;
TM1637 tm(CLK, DIO);
void setup() {
tm.init();
//tm.set(BRIGHT_TYPICAL);
tm.set(2);
pinMode(4, INPUT_PULLUP);
}
unsigned int counter = 0;
void loop() {
button=digitalRead(4);
if(button == true){
tm.display(0, (counterM / 10) % 10);
tm.display(1, (counterM / 1) % 10);
tm.display(2, (counter / 10) % 10);
tm.display(3, (counter % 10));
counter = counter + 1;
if (counter == 100) {
counter = 0;
counterM++;
}
delay(10);
}
}