How to add timer to code?

Hi i want to add a safety timer to my code. I want the timer to allow the code to run for 10 minutes and off for 10 minutes. how can I add this?

int motorPin = 2;
int solinoidPin = 3;
int buzzerPin = 8;
int isObstaclePin = 7;
int isObstacle = HIGH;

void setup() {
pinMode(motorPin, OUTPUT);
pinMode(solinoidPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(isObstaclePin, INPUT);
}

void loop() {

isObstacle = digitalRead(isObstaclePin);

if (isObstacle == LOW) {
  
  digitalWrite(motorPin, HIGH);
  
  digitalWrite(buzzerPin, HIGH);
  delay(400);
  digitalWrite(buzzerPin, LOW);
  delay(100);
  digitalWrite(buzzerPin, HIGH);
  delay(400);
  digitalWrite(buzzerPin, LOW);
  delay(100);
  delay(4000);

  digitalWrite(solinoidPin, LOW);
  
  digitalWrite(buzzerPin, HIGH);
  delay(100);
  digitalWrite(buzzerPin, LOW);
  delay(50);
  digitalWrite(buzzerPin, HIGH);
  delay(100);
  digitalWrite(buzzerPin, LOW);
  delay(50);
  digitalWrite(buzzerPin, HIGH);
  delay(100);
  digitalWrite(buzzerPin, LOW);
  delay(50);
  delay(1100);
  
  digitalWrite(motorPin, HIGH);
  
} else {
  
  digitalWrite(solinoidPin, HIGH);
  digitalWrite(motorPin, LOW); 
  digitalWrite(buzzerPin, LOW);
  }
}

Thanks

i want to add a safety timer to my code. I want the timer to allow the code to run for 10 minutes and off for 10 minutes. how can I add this?

What is a “safety timer” in your eyes? Is that a watchdog that resets the device if your code is stuck for some time? Or do you need special precautions for any of the devices connected?

I want the timer to allow the code to run for 10 minutes and off for 10 minutes. how can I add this?

How accurate does the timing need to be ? The delay()s in your code are going to throw the timing off and the time it takes to run is influenced by whether an obstacle is detected or not