// Declare pins
const int LED_PIN_1 = D0;
const int LED_PIN_2 = D6;
const int LED_PIN_3 = D7;
const int BUTTON_PIN = 26;

// Setup what the pins will do
void setup() {
  pinMode(LED_PIN_1, OUTPUT);
  pinMode(LED_PIN_2, OUTPUT);
  pinMode(LED_PIN_3, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
}

void loop() {
  // Check if the button is pressed
  if (digitalRead(BUTTON_PIN) == LOW) {
    // If button is pressed, make all LEDs blink
    digitalWrite(LED_PIN_1, HIGH);
    digitalWrite(LED_PIN_2, HIGH);
    digitalWrite(LED_PIN_3, HIGH);
    delay(500); // Blink duration
    digitalWrite(LED_PIN_1, LOW);
    digitalWrite(LED_PIN_2, LOW);
    digitalWrite(LED_PIN_3, LOW);
    delay(500); // Blink duration
  } else {
    // If button is not pressed, continue with the random LED blinking
    int randomLED = random(1, 4);
    digitalWrite(LED_PIN_1, LOW);
    digitalWrite(LED_PIN_2, LOW);
    digitalWrite(LED_PIN_3, LOW);
    switch (randomLED) {
      case 1:
        digitalWrite(LED_PIN_1, HIGH);
        break;
      case 2:
        digitalWrite(LED_PIN_2, HIGH);
        break;
      case 3:
        digitalWrite(LED_PIN_3, HIGH);
        break;
    }
    delay(random(100, 1000));
  }
}