IR library help

i want to get two decode values from two sensors at the same time
any one know how to do it with this code

/*

  • IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
  • An IR detector/demodulator must be connected to the input RECV_PIN.
  • Version 0.1 July, 2009
  • Copyright 2009 Ken Shirriff
  • http://arcfn.com
    */

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
delay(100);
}

i want to get two decode values from two sensors at the same time
any one know how to do it with this code

Use two Arduinos.

At the same time?
The IR signals will interfere with each other.

PaulS:
Use two Arduinos.

:confused:
no any method??

LarryD:
At the same time?
The IR signals will interfere with each other.

nope
it will give decode results

nope
it will give decode results

Well then, since you are sure that it can be done (it can't), go right ahead.

The IR library uses a timer to decode the incoming data. A timer means ONE timer. The same timer every time. Two instances of the class will use the SAME timer and the instances WILL interfere.

PaulS:
Well then, since you are sure that it can be done (it can't), go right ahead.

The IR library uses a timer to decode the incoming data. A timer means ONE timer. The same timer every time. Two instances of the class will use the SAME timer and the instances WILL interfere.

oops....
anyhow i found another way
thanks :slight_smile: