#include "GyverTM1637.h"
#define CLK 6
#define DIO 7
#define swtch A0
#define swtch1 A1
int swState = 0;
int timeStat;
GyverTM1637 disp(CLK, DIO);
void setup() {
disp.clear();
disp.brightness(5);
pinMode(swtch, INPUT);
pinMode(swtch1, INPUT);
}
void loop() {
if (digitalRead(swtch) == 1) {
// delay(50);
if (swState == 0){
swState = 1;
} else {
swState = 0;
}
}
if (digitalRead(swtch1) == 1) {
delay(50);
timeStat = 0;
swState = 0;
disp.clear();
disp.displayInt(timeStat);
}
if (swState == 1){
delay(1000);
timeStat += 1;
disp.displayInt(timeStat);
}
else{
//clock starts from 0 and stays freezed until i press the button 1
// tried to detect that the clock is actually on
disp.displayInt(0);
}
}