the problem is that I can't get the arduino to send any data through the IR led, if I look at it with a mobile, no activity is seen (if I connect it to VCC, the led is visible)
What Arduino? The A6 and A7 pins on the classic Nano can’t be used as digital outputs. They are only two more inputs to the multiplexer that feeds the ADC.
#include <IRremote.h> // importa libreria IRremote
void setup() {
Serial.begin(9600); // inicializa comunicacion serie a 9600 bps
IrReceiver.begin(13, DISABLE_LED_FEEDBACK); // inicializa recepcion de datos
IrSender.enableIROut(38);
}
void loop() {
if (IrReceiver.decode()) { // si existen datos ya decodificados
Serial.print(getProtocolString(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(); // resume la adquisicion de datos
}
delay (100); // breve demora de 100 ms.
}
terminal output:
//original remote
NEC : 32 : FA057F80
NEC : 32 : F8077F80
NEC : 32 : F7087F80
NEC : 32 : F6097F80
NEC : 32 : E41B7F80
//recived signal
NEC : 32 : 1FEA05F
NEC : 32 : 1FEE01F
NEC : 32 : 1FE10EF
problem:
the signal received by the arduino is not the same as by the original command
NEC : 32 : E41B7F80
NEC : 0 : 0
NEC : 0 : 0
NEC : 32 : FA057F80
NEC : 0 : 0
NEC : 32 : F8077F80
NEC : 0 : 0
NEC : 32 : F7087F80
NEC : 0 : 0
NEC : 0 : 0
NEC : 32 : F6097F80
NEC : 0 : 0
NEC : 32 : E41B7F80
NEC : 0 : 0
NEC : 32 : FA057F80
NEC : 0 : 0
NEC : 0 : 0
NEC : 32 : F8077F80
NEC : 0 : 0
NEC : 32 : F7087F80
NEC : 0 : 0
NEC : 32 : F6097F80
NEC : 0 : 0
NEC : 0 : 0
NEC : 32 : E41B7F80
NEC : 0 : 0
NEC : 32 : FA057F80
NEC : 0 : 0
NEC : 32 : F8077F80
NEC : 0 : 0
NEC : 0 : 0
NEC : 32 : F7087F80
NEC : 0 : 0
I don't know now what exactly the reason is. Try other repeat parameters than 2 when calling IrSender.sendNECRaw. Maybe 0. Otherwise change the IF condition in the code for the reception.
E.g. like this:
if (IrReceiver.decode() && IrReceiver.decodedIRData.numberOfBits > 0) { // si existen datos ya decodificados
Serial.print(getProtocolString(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(); // resume la adquisicion de datos
}
delay (100); // breve demora de 100 ms.