HarryWill / IRreciever-multi-reciever

Support multiple infrared receivers on Arduino
0 stars 0 forks source link

multiple IR receiver #1

Open pvdw0310 opened 1 year ago

pvdw0310 commented 1 year ago

Hi, Did you make a multiple IR receiver for arduino/esp8266 ?

Do you mind to share you files? I'm looking for a library to receive 5 Ir receivers with one arduino/ esp8266/esp32 Many thanks Peter

HarryWill commented 1 year ago

Hi, this is a branch I accidentally made of the actual multi-reciever IRremote library. Here is a copy of the code needed for running multiple infrared receivers.

`#include

// To support more than 5 receivers, remember to change the define // IR_PARAMS_MAX in IRremoteInt.h as well.

define RECEIVERS 4

IRrecv *irrecvs[RECEIVERS];

decode_results results;

void setup() { Serial.begin(9600);

irrecvs[0] = new IRrecv(2); // Receiver #0: pin 2 irrecvs[1] = new IRrecv(3); // Receiver #1: pin 3 irrecvs[2] = new IRrecv(4); // Receiver #2: pin 4 irrecvs[3] = new IRrecv(5); // Receiver #3: pin 5

for (int i = 0; i < RECEIVERS; i++) irrecvs[i]->enableIRIn(); }

void loop() { for (int i = 0; i < 4; i++) { if (irrecvs[i]->decode(&results)) { Serial.print("Receiver #"); Serial.print(i); Serial.print(":"); Serial.println(results.value, HEX); irrecvs[i]->resume(); } } }`

HarryWill commented 1 year ago

Let me know if you have any trouble understanding the code. For a good reference, take a look at my "Interactive Tearable Interface" repo (it's not quite finished). I used 4 infrared receivers and 4 transmitters per Arduino.

pvdw0310 commented 1 year ago

I put your sketch in the arduino IDE and it compiles well for a arduino pro mini. I understand the code you write. But there is no output on the serial monitor if I send a IR code to the receiver. If I use a example code of the IRremote library on one of the selected io-ports then I get the IR code. Is it possible that I need a different IRremote library? Can you send a link of the IRremote library you are using?

HarryWill commented 1 year ago

Yep sorry, you need the modified IR Remote library. It's in the Libraries section of my "Interactive Tearable Interface" repo. The correct library you need is IRremote-multi-reciever.

HarryWill commented 1 year ago

Here is the link: https://github.com/HarryWill/Interactive_Tearable_Interface/tree/2ade113f70798e6b4fd7f105b56299cb8b044fcf/Libraries/IRremote-multi-receiver

pvdw0310 commented 1 year ago

Thank you, thank you, thank you. With some changes to the .ino file, it works perfect. You were very helpful and it was a quick reply.

Best regards Peter