2 Infrared break beam and readout

Hi All,

I have 2 38 mhz recievers (TSOP 38438). I can get pin B to detect on both of my circuits. I'm having an issue with pin a.

My end goal is anytime either beam is broken, it triggers an Output "switch" for a few seconds.

I really appreciate the help in advance. I've tried (using Iremote) library...

#include <IRremote.h>

#define LEDPIN_A 13

#define PINIR_A 2
#define PINIR_B 4

#define SENSORPIN_A 5
#define SENSORPIN_B 6

// variables will change:
int sensorState_A = 0, lastState_A = 0;
int sensorState_B = 0, lastState_B = 0;

IRsend irsend;
void setup()
{
// initialize the LED pin as an output:
pinMode(LEDPIN_A, OUTPUT);
// initialize the sensor pins as an input and enable internal pullup:
pinMode(SENSORPIN_A, INPUT_PULLUP);
pinMode(SENSORPIN_B, INPUT_PULLUP);
Serial.begin(9600);
//set carrier frequency
irsend.enableIROut (38);
irsend.mark (0);
}

void loop()
{
// read the state of the sensor:
sensorState_A = digitalRead(SENSORPIN_A);
sensorState_B = digitalRead(SENSORPIN_B);

// check if the sensor beam is broken
// if it is, the sensorState is LOW:
if (sensorState_A == LOW)
{
// turn LED on:
digitalWrite(LEDPIN_A, HIGH);
}
else
{
// turn LED off:
digitalWrite(LEDPIN_A, LOW);
}
if (sensorState_A && !lastState_A)
{
Serial.println("A Unbroken");
}
if (!sensorState_A && lastState_A)
{
Serial.println("A Broken");
}
lastState_A = sensorState_A;

if (sensorState_B == LOW)
{
// turn LED on:
digitalWrite(LEDPIN_A, HIGH);
}
else
{
// turn LED off:
digitalWrite(LEDPIN_A, LOW);
}

if (sensorState_B && !lastState_B)
{
Serial.println("B Unbroken");
}
if (!sensorState_B && lastState_B)
{
Serial.println("B Broken");
}
lastState_B = sensorState_B;
delay(500); // so we don't flood the serial port
}

eskerness:
I'm having an issue with pin a.

Care to elaborate?

If you simply have a beam break application, you don't use the IR library. That is necessary only if you want to start decoding information from a remote control device such as for a television. The library probably does not even support multiple sensors.

Simply treat the TSOP as a low side switch and poll it in the loop(), or with a timer to check the status of the beam.