Switch with different delays

delchrys:
but if the 12601000UL is running, the loop just waits and will never see a change of the switchpin.
So i have to wait until the delays is finished???

No it does not :wink: You are confusing "delay(12 * 60 * 1000UL)" with "unsigned long delay = 10 * 60 * 1000UL".

All I did was assiging two different values to a variable called "delay" depending on the state of a switch. After that you can use that variable "delay" in you millis()-based delay.

unsigned long delay;

if(digitalRead(SwitchPin)){
  delay = 1 * 1000UL;
}
else{
  delay = 12 * 60 * 1000UL;
}


if(millis() - previousMills >= delay){
  previousMillis = millis();

  //do what you want to do
}