Function must stay high i a long period ???

A Little problem:

I have serveral function that can make a specific output goes high – that´s working perfect!
But I have an additional function that I want: a function that make the output goes high, and stay that in a time period (2-3 hours) even though that data change, also the data that was the reason for the output original changed to high. If other function’s in the time period want to change the output to low that must also be blocked.

How do I do that???

Do I have so write that I am relative new in Arduino programming? I think that you already can see that…

Hi

you could set a boolean variable to true to mark that you want to deny any change request to the pins and then in the rest of the code, before modifying a pin status, you check in you are in the right mode.

you can also time when you started being in this blocked mode, and auto release after 3 hours using millis()

bool denyChangeRequest;
unsigned long forcedHighModeStartTime;
const unsigned long threeHours = 10 800 000UL;
...
void forceHighMode()
{
  digitalWrite(pin1, HIGH);
  digitalWrite(pin2, HIGH);
  digitalWrite(pin3, HIGH);
  forcedHighModeStartTime = millis()
  denyChangeRequest = true;
}

void conditionalDigitalWrite(uint8_t aPin, uint8_t aState)
{
  // when modifying pins, ensure you have the right to do so
  if (not denyChangeRequest) { // it's OK to modify pins
    digitalWrite(aPin, aState);
  }
}
 
void loop()
{
...
  // check if it's time to remove the restriction
  if (denyChangeRequest  && (millis() - forcedHighModeStartTime >= threeHours)) {
    denyChangeRequest = false;
  }
...
  // don't use digitalWrite directly, but your own version
  conditionalDigitalWrite(pin1, HIGH);
  conditionalDigitalWrite(pin2, LOW);
...
}