I was looking for a simple solution to a failed, one of several, commercial bathroom PIR controlled run-on fan timer. Start the fan running when the bathroom is first occupied, ignore PIR detections for the duration of the fan timer run, say 10-minutes, and retrigger at the end of the set time.
So many of these commercial units fail, the last one would turn the fan off, ignore the set time, and turn off when it felt like it.
Delay() seems to be ideal and works as required. During the delay, of course it ignores the PIR pulses. There's nothing else that needs monitoring.
Delay() will do for now until I find time to do an elapsed millis() version.
If it works, then why change it? I'll keep saying it for as long as I need to: there's nothing wrong with delay(). For most circumstances, it's the ideal solution, but it keeps being dismissed as "too basic."
More interesting would be how you integrated an Arduino with an existing bathroom fan which is presumably mains operated. Is the PIR sensor also part of the commercial bathroom fan assembly ?
The fan and PIR (Occupancy sensor) unit are separate, like a PIR sensor that controls a remote outdoor lamp.
I keep the plastic case of the failed sensor, use it's lens etc. All that goes in the original unit is one of those PIR (BIS1000) chipped modules.
The Arduino, power supply etc go into the ceiling void.
The real object is avoid any more of these impossible to fix commercial units (Danlers, Timeguard) and use something I can fix, if it needs it. It also opens up the possibility of remote control, changing settings and integrating other sensors like humidity.