int buzzerPin = 12;             // Replace with your buzzer pin number
int switchPin = 10;             // Replace with your switch pin number
int ledPins[] = {2, 4, 6, 8};   // Replace with your LED pin numbers

void setup() {
  for (int i = 0; i < 4; i++) {
    pinMode(ledPins[i], OUTPUT);
  }
  pinMode(switchPin, INPUT_PULLUP);
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600); // Initialize serial communication for debugging
}

void loop() {
  if (digitalRead(switchPin) == LOW) {
    // Activate both siren and LEDs
    activateSirenAndLEDs(20000);
  }
}

void activatePoliceSiren() {
  // Rising tone
  for (int frequency = 500; frequency <= 2000; frequency += 50) {
    tone(buzzerPin, frequency);
    delay(10); // Adjust the delay for the rising tone speed
  }

  // Falling tone
  for (int frequency = 2000; frequency >= 500; frequency -=50) {
    tone(buzzerPin, frequency);
    delay(10); // Adjust the delay for the falling tone speed
  }

  noTone(buzzerPin); // Turn off the buzzer
}

void activateSirenAndLEDs(int duration) {
  unsigned long startTime = millis();

  // Continue the siren and LED loop for the specified duration
  while (millis() - startTime < duration) {
    for (int i = 0; i < 4; i++) {
      digitalWrite(ledPins[i], HIGH); // Turn on each LED in sequence
      delay(10); // Adjust the delay for the "on" state
      digitalWrite(ledPins[i], LOW); // Turn off the LED
      delay(10); // Adjust the delay for the "off" state
    }
    activatePoliceSiren();
  }

  // Turn off all LEDs after the siren duration
  for (int i = 0; i < 4; i++) {
    digitalWrite(ledPins[i], LOW); // Turn off all LEDs
  }
}
$abcdeabcde151015202530354045505560fghijfghij