i created two independent circuits for receiver and transmitter. Both are arduino uno, and uploaded this code to the arduino.
fortunately both works, the transmitter sends the code and receives to the other end. But when I used it to command to turn off (38863BD2) my tv which i decoded earlier, nothing happens. Tried multiple times
#include <IRremote.h>
const int RECV_PIN = 6;
IRsend irsend;
IRrecv irrecv(RECV_PIN);
decode_results results;
int sr = 9;
int x=LOW;
int i =0;
void setup()
{
Serial.begin(9600);
pinMode(sr, INPUT);
irrecv.enableIRIn();
irrecv.blink13(true);
}
void loop() {
x= digitalRead(sr);
// for sending
if (x == HIGH){
Serial.print("send");
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0x38863BD2, 32);
delay(20);}}
// for receiving
if (irrecv.decode(&results)) {
if (results.decode_type == NEC) {
Serial.print("NEC ");
} else if (results.decode_type == SONY) {
Serial.print("SONY ");
} else if (results.decode_type == RC5) {
Serial.print("RC5 ");
} else if (results.decode_type == RC6) {
Serial.print("RC6 ");
} else if (results.decode_type == UNKNOWN) {
Serial.print("UNKNOWN ");
}
Serial.print(" ");
Serial.print(results.value, HEX);
Serial.print(" ");
Serial.println(results.bits);
irrecv.resume();
}}