check time before performing a command

Hi, I am fairly new to Arduino, and I am still sort of learning the basics, but I had a question about a project I’m working on.

Say I wanted to measure something in the environment with a sensor. The input from the sensor either displays a 1 or a zero on the serial monitor, based on what it detects.

I want to set a pin to high if and only if a constant reading of zero has been detected for a certain amount of time, and I don’t want to set the pin back to low until a value of zero is no longer detected. If anyone could help me with this it would be greatly appreciated.

Non-blocking timing tutorials:
Several things at a time.
Beginner’s guide to millis().
Blink without delay().