Infrared Tripwire

Hi! I am wondering how I can use an Infrared LED and Infrared Sensor as a tripwire. I want it to work so that when the IR signal is blocked, it would light up a green LED. Any help would be great!

Something like this

void setup() {
  pinMode(7, OUTPUT); // connection to resistor and LED
  pinMode(8, INPUT);  // connection to IR receiver 
}

void loop() {
   if (digitalRead(8) == LOW) {
      digitalWrite(7, HIGH);
   }
   else {
     digitalWrite(7, LOW);
   }
}

In other words it should be fairly simple. But you haven't said what IR devices you plan to use.

...R

Search for
IR receiver light barrier

and also start by trying out all of the examples in the IRremote and/or IRLib libraries....