int Pin1 = 26;
int Pin2 = 0;
int Pin3 = 1;
int Button = 27;
int ButtonCounter = 0;
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 50;
void setup() {
pinMode(Pin1, OUTPUT);
pinMode(Pin2, OUTPUT);
pinMode(Pin3, OUTPUT);
pinMode(Button, INPUT_PULLDOWN);
}
void loop() {
int buttonState = digitalRead(Button);
if (buttonState == HIGH && millis() - lastDebounceTime > debounceDelay) {
ButtonCounter++;
lastDebounceTime = millis();
if (ButtonCounter == 1) {
digitalWrite(Pin1, HIGH);
delay(1000);
digitalWrite(Pin1, LOW);
} else if (ButtonCounter == 2) {
digitalWrite(Pin2, HIGH);
delay(1000);
digitalWrite(Pin2, LOW);
} else if (ButtonCounter == 3) {
digitalWrite(Pin3, HIGH);
delay(1000);
digitalWrite(Pin3, LOW);
} else if (ButtonCounter == 4) {
digitalWrite(Pin1, HIGH);
digitalWrite(Pin2, HIGH);
digitalWrite(Pin3, HIGH);
delay(1000);
digitalWrite(Pin1, LOW);
digitalWrite(Pin2, LOW);
digitalWrite(Pin3, LOW);
ButtonCounter = 0;
}
}
}