Setting Delay for All Activity

I am needing to control a Halloween prop via a Try Me switch where the prop turns on and off with each press of the switch. I'll be using a pressure mat or a PIR to trigger the prop. My question is what would be the best way to delay or pause any further input for a given amount of time to allow the prop ample time to do its thing even if the PIR sensor or pressure sensor is triggered again (which will shut it off prematurely without a delay)?

Thanks, Greg

what would be the best way to delay or pause

"best" is very subjective.

There is an example called BlinkWithoutDelay BWD found in the examples with the IDE.

Have you written any code?



What @spycatcher2k said has a lot of common sense.

If you do need to check sensors more frequently (which would be more usual) you need a flag variable that records the fact that the action is in progress.

The demo Several Things at a Time is an extended example of BWoD and may be useful.