unsigned long startMillis;  // Start millis variable to keep track of the start time of the timer

int buzzerPin = 9;

void setup() {
  pinMode(9, OUTPUT);

  startMillis = millis(); // Update start time

  while (startMillis + 360000 > millis()) { // RUN 1st for 6 minutes = 360 000 milliseconds
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(20);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(22);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(24);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(26);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(28);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(30);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(32);
  }

  startMillis = millis();

  while (startMillis + 1800000 > millis()) {  // RUN 2nd for 30 minutes = 1 800 000 milliseconds
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(20);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(18);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(16);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(14);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(12);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(8);
    digitalWrite(9, HIGH);
    delay(3);
    digitalWrite(9, LOW);
    delay(6);
  }
}

void loop() { // Nothing needed to do here

}