Programming recommendations

I am trying to write code to:
Once an IR is activated (digitalRead IR, LOW)
LED turns on (DigitalWrite LED LOW)
Note: The IR at this point will see some on/off states (NOT DEBOUNCE)
Once the IR sees 10 seconds of no activate
LED turns off (DigitalWrite LED, HIGH)

Is this accomplished with a counter or ?????
Any recommendations or direction will be helpful
Brian K

Start with a simple sketch that turns your LED on when the IR is triggered.

Then add functionality that captures millis in a variable when the IR is triggered as well.

if captured time is greater than ten seconds, turn the LED off.

To keep the LED pin LOW until the IR pin is HIGH for ten seconds:

const byte LEDPin = 2;
const byte IRPin = 3;
unsigned long IRTimer;

void setup()
  digitalWrite(LEDPin, HIGH);  //  LED Off
  pinMode(LEDPin, OUTPUT);

  pinMode(IRPin, INPUT);

void loop()
  if (digitalRead(IRPin) == LOW)
    // IR Input is ACTIVE
    digitalWrite(LEDPin, LOW);  // LED On
    IRTimer = millis();  // Re-start the IR timer.

  if (millis() - IRTimer > 10000UL)
    // IR Input has been INACTIVE for 10 or more seconds
    digitalWrite(LEDPin, HIGH);  //  LED Off