use 2 ir recevier

Hi, i try to use 2 ir recevier in the same time with arduino, and i try to se from what ir is the signal coming.
my ir are TSOPxxxx, but the problem is in the program, i don’t know how to use 2 ir recevier on the same arduino.
i try to make something like this but dont work:

// example 32.1 - IR receiver code repeater
// http://tronixstuff.com/tutorials > chapter 32
// based on code by Ken Shirriff - http://arcfn.com
#include <IRremote.h> // use the library
int dx_ir = 10; // pin 1 of IR receiver to Arduino digital pin 11
int sx_ir = 11;

IRrecv irrecv1(dx_ir); // create instance of 'irrecv'
decode_results dx_r;
IRrecv irrecv2(sx_ir); // create instance of 'irrecv'
decode_results sx_r;

void setup()
{
  Serial.begin(9600); // for serial monitor output
  irrecv1.enableIRIn(); // Start the receiver
  irrecv2.enableIRIn(); // Start the receiver
}
void loop()
{
  if (irrecv1.decode(&dx_r)) // have we received an IR signal?
  {
   // Serial.println(dx_r.value, HEX); // display it on serial monitor in hexadecimal
    irrecv1.resume(); // receive the next value
        irrecv2.resume(); // receive the next value
    Serial.println("DX");
  } 
    if (irrecv2.decode(&sx_r)) // have we received an IR signal?
  {
   // Serial.println(dx_r.value, HEX); // display it on serial monitor in hexadecimal
    irrecv2.resume(); // receive the next value
        irrecv1.resume(); // receive the next valueù
    Serial.println("SX");
  }
}

i try to make something like this but dont work:

Can you be more specific?

i use this library https://github.com/shirriff/Arduino-IRremote and i connect the 2 ir at pin 10 and 11. if i use only one pin the code works.

So the code works as expected if you connect receiver A to pin 10 or receiver A to pin 11 or receiver B to pin 10 or receiver B to pin 11 but you receive nothing at all if you connect A to 10 and B to 11 or A to 11 and B to 10?

whit this code only the last pin declared work, in this case pin 11.

boghy933: whit this code only the last pin declared work, in this case pin 11.

I just looked at the library sources and it looks like that is a limitation of the library. When an IRrecv object is created the pin to read is stored in a global structure: volatile irparams_t irparams; The library should have made that clear by making IRrecv a "singleton": an object of which there can be only one instance.