Reapeating a void for 10 seconds

Dear everybody,

does anyone know how to repeat a void like this, and let it repeat itself for 10000 milliseconds?

void zoekfunctie_aan (){
  if (status_zoekfunctie == LOW){ 
   unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis > intervalalarm) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;  

    // if the LED is off turn it on and vice-versa:
    if (int_zoekfunctie == HIGH){
      int_zoekfunctie = LOW;
      Serial.println("Zoekfunctie aan");
    } else {
      int_zoekfunctie = HIGH;
      status_zoekfunctie = HIGH;
      Serial.println("zoekfuntie uit");
      waarde_zoekfunctie = 0;

 
    };
    // set the LED with the ledState of the variable:
    digitalWrite(claxon, int_zoekfunctie);
    digitalWrite(verlichting, int_zoekfunctie);
  }
 }
}

Thanks for the replies!
Greetings

The first thing to say is that is not a void it is a function that does not return a value, hence it is void. Secondly can you please explain what exactly you want to do. Do you want the function to be called every 10 seconds or something else ?

Would something like this meet your requirement - it calls the function over and over for a period

void runFunction() {
   if (currentMillis - functionStartMills < runTimeMillis) {
      zoekfunctie_aan ();
   }
}

Note that you should make currentMillis global and update it in loop() so it is available everywhere.

...R

Hello and thanks for the replies,

I want this function to blink for 10 seconds.
my "intervalalarm" is stated as 1000 milliseconds.
So what I want to create is that the LED's are on for 1 sec, than of for 1 sec, again on 1 sec etc etc.
so I want it to blink 5 times.

jensgorisse:
so I want it to blink 5 times.

for (n = 0; n < 5; n++) {
    // blink
}

...R