Multiple uses of the IRremote.h library output

Hello

I have a routine using #include <IRremote.h>

I declare:

IRrecv irrecv(OnboardIRin);                                                                                       
decode_results results;
IRsend irsend;

And then:

irrecv.enableIRIn();    

To start the receiver. I can then read the incoming data.

But, my project has two IR receivers. One remote and one onboard the PCB. If possible, I would like to read them both and independently decode their data.

How do I declare the above for two different inputs? (If indeed, that is possible).

The only other way I can think of is to 'switch' between the pins when checking the input (if that would work).

Thanks

The library does not allow for multiple receivers. But receivers can be connected to the same input pin. That works as long as only one remote is sending at the same time. Otherwise you should use one Arduino for each IR receiver.

Thank you. OK, a bit of PCB re-designing required then.
My external IR and internal IR have their own pins.

Reason being, the outside remote does something different to the inside one. I'll have to somehow work that out in the code (in case some of the codes overlap).

Thanks for your help

If I have 2x receivers (for example TSOP4838), can the outputs of these simply be joined together on the Arduino pin? Or do they need some kind of separation?

If you are using the latest version of the IRremote library (>3.0) that is not correct. See the IRremote library GitHub page for the current usage and how to fix older code to work with the newer version of the library.

"for example" is not very helpful with module internals. But this module, as any other IR receiver I've seen, have an o.c. output with a pullup resistor. Thus at least 2 receiver outputs can be directly connected as "wired AND".

You can calculate the safe amount from the resulting resistance, max. output current and supply voltage. Above module has a 33k pullup that draws 0.15mA at 5V. The guaranteed (LOW) output current is 5mA so that up to 33 receivers can be connected to the same input pin.

Thanks. That is the sensor I am using.
I have altered the PCB design to use the same pin for both IR inputs. I will breadboard that later and ensure it works OK.
I have utilised the spare input pin I now have to detect when the 3.5mm external IR jack is inserted.

I just updated the IRremote library.

Thanks again