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);
}
}
}
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 ?
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.