// put your void setup() {
// put your setup code here, to run once:
}
const int buttonPin = D1;
const int led1Pin = D7;
const int led2Pin = D6;
const int maxClicks = 5;
int clickCount = 0;
bool startCounting = false;
unsigned long lastButtonClickTime = 0;
unsigned long countingInterval = 5000; //
void setup() {
pinMode(buttonPin, INPUT);
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
}
void loop() {
int buttonState = digitalRead(buttonPin);
if (buttonState == HIGH && !startCounting) {
delay(50); // Debounce delay
if (digitalRead(buttonPin) == HIGH) {
//
startCounting = true;
lastButtonClickTime = millis();
}
}
if (startCounting && (millis() - lastButtonClickTime) >= countingInterval) {
/
clickCount = min(clickCount, maxClicks); //
activateLEDs(clickCount);
//
clickCount = 0;
startCounting = false;
delay(500);
}
}
void activateLEDs(int count) {
for (int i = 0; i < count; i++) {
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
delay(500);
digitalWrite(led1Pin, LOW);
digitalWrite(led2Pin, LOW);
delay(500);
}
}
void loop() {
//
}