Hello, recently I have been working on the IR library to replicate the signals from my remote control, and I have encountered some problems. I am using an Arduino NANO, and the library I am currently using is the IRremote by ArminJo version 4.4.3 (link:GitHub - Arduino-IRremote/Arduino-IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols). The following is my code to send the IR signal. As for the wiring diagram, I simply connected an IR led to pin 3 and a button to pin 10.(IR led 940nm 5mm)
#include <IRremote.h>
#define IR_SEND_PIN 3
#define FEEDBACK_LED_PIN LED_BUILTIN
#define Button_PIN 10
int ButtonState;
uint16_t rawData[] = {
1250,350,
1250,350,450,1250,1200,400,1250,350,
450,1200,400,1300,350,1250,450,1200,
450,1250,450,1200,1250,7150,1200,350,
1200,400,350,1300,1200,350,1200,400,
350,1300,350,1250,400,1250,350,1300,
350,1300,400,1250,1150,7200,1150,400,
1200,400,350,1250,1200,400,1150,450,
350,1250,350,1300,350,1250,350,1300,
350,1300,350,1300,1150
};
void setup() {
Serial.begin(115200);
pinMode(Button_PIN,INPUT_PULLUP);
IrSender.begin(IR_SEND_PIN, true, FEEDBACK_LED_PIN);
Serial.println("IR Ready");
}
void loop() {
ButtonState=digitalRead(Button_PIN);
if (ButtonState==0){
IrSender.sendRaw(rawData, sizeof(rawData) / sizeof(rawData[0]), 38);
delay(2000);
Serial.println("IR sent.");
};
}
The rawData inside the code is the on/off signal for my fan (fan is from CHIMEI), and I collected the signal by using the IRremote example SimpleReceiver. The code worked when I tried to open and close my fan. However, when I changed the rawData to my AC signal, it won't work. The following is the signal for my AC. This is the signal that I have received from my serial monitor multiple times in the SimpleReceiver example, so I am pretty sure that this is the correct signal. (AC is from HITACHI)
3450,1500,
550,1050,600,350,600,300,600,300,
600,300,600,350,550,350,550,400,
500,400,500,450,450,450,450,450,
450,1200,450,450,450,450,500,450,
450,450,450,450,500,450,450,450,
450,500,450,450,450,450,450,500,
450,450,450,500,450,450,450,500,
400,500,450,450,450,1150,450,500,
450,1200,450,1150,450,1200,400,1200,
450,1200,400,1150,500,450,450,1200,
450,1150,450,1200,400,1200,450,1200,
400,1200,450,1150,450,1200,400,1200,
450,500,400,500,450,450,450,500,
400,500,450,450,450,500,400,500,
450,500,400,500,450,1150,450,1200,
400,500,450,450,450,1200,400,1200,
450,1200,400,1200,450,450,450,500,
400,1200,450,1200,400,500,400,500,
450,500,400,1200,450,500,400,500,
450,1150,450,500,400,500,450,1200,
400,1200,450,450,450,1200,400,1200,
450,500,400,1200,450,1150,450,500,
450,1200,400,1200,400,500,450,500,
400,1200,400,500,450,450,450,500,
450,450,450,500,400
I have considered that maybe the distance between me and my AC was too far, so I held my whole breadboard as close as possible to the AC, but it still didn't work. Much appreciated if anyone could answer my question.
