hi, i have a quostion, this code for a stopwacth with TM1637 is not working, sometimes it is just counting al the time or it stays at 1. could someone help me to solve it?
//#include <Arduino.h>
#include <TM1637Display.h>
// Module connection pins (Digital Pins)
#define CLK_TM 2
#define DIO_TM 3
// The amount of time (in milliseconds) between tests
#define TEST_DELAY 2000
const int bouton = 4;
const int buttonPin2 = 6;
const uint8_t SEG_DONE[] = {
SEG_B | SEG_C | SEG_D | SEG_E | SEG_G, // d
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O
SEG_C | SEG_E | SEG_G, // n
SEG_A | SEG_D | SEG_E | SEG_F | SEG_G // E
};
TM1637Display display(CLK_TM, DIO_TM);
int etatBouton,k,test,buttonState2;
void setup()
{
pinMode(bouton, INPUT);
etatBouton = 0;
buttonState2=1;
test=0;
k=0;
display.setBrightness(7);
}
void loop()
{ etatBouton = digitalRead(bouton);
bool lz = true;
if(etatBouton == HIGH) {
k++;
display.showNumberDec(k, lz);
delay(1000);
}
}