Multiple IR Sensors on separate receiving pin #1789
-
Good morning, I need to connect two or more separated sensors on my ESP32, and discriminate which sensor receives the IR signal from the transmitter. Someone know if it's possible? Thank in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
No. Not with this library as it stands. See the FAQ on the matter. |
Beta Was this translation helpful? Give feedback.
-
Come on, it's easy: #include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
uint32_t IRdata1 = 0;
uint32_t IRdata2 = 0;
#define IRpin1 14
#define IRpin2 2
IRrecv IRrecv1(IRpin1);
IRrecv IRrecv2(IRpin2);
decode_results results1;
decode_results results2;
void setup() {
Serial.begin(115200);
delay(1000);
IRrecv1.enableIRIn();
IRrecv2.enableIRIn();
}
void loop() {
if (IRrecv1.decode(&results1))
{
IRdata1 = results1.value;
Serial.print("IR data 1: ");
Serial.println(IRdata1);
IRrecv1.resume();
}
if (IRrecv2.decode(&results2))
{
Serial.print("IR data 2: ");
IRdata2 = results2.value;
Serial.println(IRdata2);
IRrecv2.resume();
}
} |
Beta Was this translation helpful? Give feedback.
-
Thanks for the explanation. |
Beta Was this translation helpful? Give feedback.
-
Hey, |
Beta Was this translation helpful? Give feedback.
No. Not with this library as it stands. See the FAQ on the matter.