Ir reciever module (is reciving but idk how to send signal)

i use below code to recive and send ir to turn on the tv, i use this module

i click ON/OFF button in tv remote and in serial i recive this :

Serial.println(results.value);   with value    326726612

now i try to pass that code to serial (so the module will send ir data and turn on the tv)
i recive mssage

Serial.print("Data sent via IR - (INT): "); with value 326726612

but nothing happen and tv is not starting


#include <IRremote.h>

#define IR_RECEIVER_PIN 19 // RX1 pin on the Arduino Mega
#define IR_TRANSMITTER_PIN 18 // TX1 pin on the Arduino Mega

IRrecv irReceiver(IR_RECEIVER_PIN);
IRsend irTransmitter(IR_TRANSMITTER_PIN);
decode_results results;

void setup() {
  Serial.begin(9600);
  irReceiver.enableIRIn();
}

void loop() {
  //IR RECIEVER
  if (irReceiver.decode(&results)) {
    // Print the received IR signal value
    Serial.print("Received value from ir reciever (INT): ");
    Serial.println(results.value);

    irReceiver.resume();
  }


  //IR SEND
if (Serial.available()) {
  // Read the incoming data from the Serial interface
  String data = Serial.readStringUntil('\n');
  unsigned long value = strtoul(data.c_str(), NULL, 10);

  // Print the hex value that was sent via IR
  Serial.print("Data sent via IR - (INT): ");
  Serial.println(value);
  
  // Send the data via IR transmitter
  irTransmitter.sendNEC(value, 32);

}
  
}

Use hexadecimal representation in matters like this. Decimal representation is useless.
Please post a link to the datasheet. Sales site picture tells nothing.
Please post schematics.

i tried to convert in hex

Received value from IR receiver (HEX): 0x137973D4

but when i pass 0x137973D4 to serial nothing happen with tv

#include <IRremote.h>

#define IR_RECEIVER_PIN 19 // RX1 pin on the Arduino Mega
#define IR_TRANSMITTER_PIN 18 // TX1 pin on the Arduino Mega

IRrecv irReceiver(IR_RECEIVER_PIN);
IRsend irTransmitter(IR_TRANSMITTER_PIN);
decode_results results;

void setup() {
  Serial.begin(9600);
  irReceiver.enableIRIn();
}

void loop() {
  // IR RECEIVER
  if (irReceiver.decode(&results)) {
    // Print the received IR signal value in HEX
    Serial.print("Received value from IR receiver (HEX): 0x");
    Serial.println(results.value, HEX);
    
    Serial.print("Protocol: ");
    Serial.println(results.decode_type);

    irReceiver.resume();
  }

  // IR SEND
  if (Serial.available()) {
    // Read the incoming data from the Serial interface
    String data = Serial.readStringUntil('\n');
    unsigned long value = strtoul(data.c_str(), NULL, 16); // Parse HEX number

    // Print the HEX value that was sent via IR
    Serial.print("Data sent via IR (HEX): 0x");
    Serial.println(value, HEX);

    // Send the data via IR transmitter
//    irTransmitter.sendNEC(value, 32);
    irTransmitter.sendNEC(value, 0x20);

  }
}


Are the IR frequencies set to the same? I have a memory saying there is more then one kind of IR links.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.