constexpr int ButtonPins[] {A0, A1};
constexpr int LedPin {9};
enum PB {One, Two};
void setup(void)
{
for (auto ButtonPin : ButtonPins) pinMode(ButtonPin, INPUT_PULLUP);
pinMode(LedPin, OUTPUT);
}
void loop(void)
{
static int timerFired = LOW;
static unsigned long stamp;
const unsigned long duration = 5000;
if (digitalRead(ButtonPins[One]) ? LOW : HIGH == HIGH) stamp = millis(), digitalWrite(LedPin, LOW), timerFired = LOW;
if (millis() - stamp >= duration) timerFired = HIGH;
digitalWrite(LedPin, digitalRead(ButtonPins[Two]) ? LOW : HIGH && timerFired);
}