I have this code:
#include <IRremote.h>
int SENSOR = 3;
void setup() {
Serial.begin(9600);
IrReceiver.begin(SENSOR, DISABLE_LED_FEEDBACK);
}
void loop() {
if (IrReceiver.decode()) {
Serial.print(IrReceiver.decodedIRData.protocol);
Serial.print(" : ");
Serial.print(IrReceiver.decodedIRData.numberOfBits);
Serial.print(" : ");
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX); // imprime valor en hexadecimal en monitor
IrReceiver.resume();
delay (100);
}
with the function:
IrReceiver.decodedIRData.protocol
Is there a table with the relationships between the number and the protocol?
in my case it answers me 7, what does it mean?
What does the documentation say?
I can't find anything about it in the documentation.
Please provide a link to the documentation.
The enum is in "IRProtocol.h". You have to count up from 0 to get the number and you have to know what options were selected. 7 is either "LG2" or "NEC".
Maybe you can call getProtocolString( IrReceiver.decodedIRData.protocol) to get the name of the protocol.
There is also an IrReceiver.printIRResultShort(Serial); which prints out a one-line summary of the received message, including the protocol name.
Great, when I can I'll try it and comment
Hello, I already got the decoder correctly, now I have the following code:
#include <IRremote.h> // importa libreria IRremote
#define Boton_1 0xFA057F80
#define Boton_2 0xF8077F80
#define Boton_3 0xF7087F80
#define Boton_4 0xF6097F80
#define Boton_5 0xE41B7F80
int SENSOR = A0; // sensor KY-022 a pin digital 11
void setup() {
Serial.begin(9600);
IrReceiver.begin(SENSOR, DISABLE_LED_FEEDBACK);
}
void loop() {
IrSender.enableIROut(38);
IrSender.sendNEC(Boton_1, 32);
delay (2000);
IrSender.sendNEC(Boton_2, 32);
delay (2000);
IrSender.sendNEC(Boton_3, 32);
delay (2000);
IrSender.sendNEC(Boton_4, 32);
delay (2000);
IrSender.sendNEC(Boton_5, 32);
delay (2000);
}
my problem is that the arduino nano, which has the code, does not emit anything through port A0, which may be happening, I try to make the arduino nano send me data via NEC to an arduino leonardo with the above code
Did you mean IrSender.begin(SENSOR, DISABLE_LED_FEEDBACK);?
oops, I didn't realize that mistake, now I'll fix it and let you know.
I add a few more questions, does the IRRemote library admit more than one entry?
and more than one exit?
I don't understand the question. What do you mean by "entry" and "exit"?
I mean, have 3 ir leds, and use them independently to control 3 devices in different zones
How can you emit from a receiver? That's what a
sensor KY-022
is.
int SENSOR = A0; // sensor KY-022 a pin digital 11
Now, it would be good to post a diagram, especially when you are talking about multiple receivers/transmitters.
I believe the answer is No. There is one "IrSender" object defined for you and I see no way to create more. There are other IR Remote Control libraries. Perhaps one of them allows multiple senders and/or multiple receivers.
to begin with, the idea is to put the transmitting leds with the common negative, and each led with its respective resistance to an undetermined pin of an arduino nano, it has no more compication (in theory), for the purpose of emitting multiple leds I occurs:
void IRSend(long hex_, int pin_, int bytes_){
IrSender.begin(pin_, DISABLE_LED_FEEDBACK);
IrSender.sendNEC(hex_, bytes_);
}
so that for each pin, I call this function with the desired parameters, but I still have the emitter problem, I've tried multiple pins and nothing, any ideas?
With the right external switching hardware, you could do that. Post a good schematic of your circuit, perhaps we can make it work and/or improve it.
The bare circuit, as you have described it, would be a very weak transmitter because the current delivered to the LEDs would be quite low.
Actually, I lied a bit, I'm skipping the IR LED step, the device I want to control has the external sensor, with 3 pins (3v, Data and GND), based on this information, my idea is to connect the emitter 5v through a resistive divider, to adjust the voltage level, but again, my problem right now is that the emitter doesn't do anything.
Two things to remember if you want to bypass the IR receiver:
- The sender is sending a modulated signal. The IR Receiver demodulates the signal so you want a demodulated signal.
- The IR Receiver signal is HIGH when idle and LOW when receiving so you need to invert the signal.
well, taking into account the last message this occurs to me, the sensor that is in the diagram is the same as the equipment that I want to control, the idea is that from the 2n2222 of the leds I always emit the same signal, only one, to choose from which device to talk to, I have to enable the 2n2222 corresponding to each sensor
But I repeat, my problem is still there, the sender arduino does not send anything through the data channel, would it have to have the same circuit to connect one arduino with another?
Bumping a thread is a violation of forum rules.