Cant't clone ir signal?

hey,
I want to clone an ir signal so I can send the same signal just with the arduino,
So I'm using this code to receive ir signals:

`#include <IRLibRecvPCI.h>
IRrecvPCI myReceiver(2);
void setup() {
  Serial.begin(9600);
    
  myReceiver.enableIRIn();
  Serial.println("Ready to receive IR signals");
  Serial.println("Point the remote controller to the IR receiver and press!");
}
void loop() {
  if (myReceiver.getResults()) {
    Serial.println("\n\n-------------------------");
    Serial.println("Received IR signal:");

    Serial.print(F("\n#define RAW_DATA_LEN "));
    Serial.println(recvGlobal.recvLength, DEC);

    Serial.print(F("uint16_t rawData[RAW_DATA_LEN]={\n"));
    for (bufIndex_t i = 1; i < recvGlobal.recvLength; i++) {
      Serial.print(recvGlobal.recvBuffer[i], DEC);
      Serial.print(F(", "));
      if ((i % 8) == 0) {
        Serial.print(F("\n"));
      }
    }
    Serial.println(F("1000};"));
    Serial.println("-------------------------");

    myReceiver.enableIRIn();
  }
}
`

So I'm getting different arrays for the same button which is weird.
I got the array the repeats most:

#define RAW_DATA_LEN 24
uint16_t rawData[RAW_DATA_LEN]={
1158, 502, 1182, 530, 334, 1346, 1158, 526, 
1158, 530, 358, 1322, 334, 1346, 334, 1342, 
362, 1318, 362, 1298, 1178, 502, 362, 1000};

and I used this code:


#include <IRLibSendBase.h>    //We need the base code
#include <IRLib_HashRaw.h>    //Only use raw sender

IRsendRaw mySender;

#define RAW_DATA_LEN 24
uint16_t rawData[RAW_DATA_LEN]={
1158, 502, 1182, 530, 334, 1346, 1158, 526, 
1158, 530, 358, 1322, 334, 1346, 334, 1342, 
362, 1318, 362, 1298, 1178, 502, 362, 1000};

void setup() {
  Serial.begin(9600);

}

void loop() {
 

  if (Serial.read() != -1) {
    //send a code every time a character is received from the 
    // serial port. You could modify this sketch to send when you
    // push a button connected to an digital input pin.
    mySender.send(rawData,RAW_DATA_LEN,38);//Pass the buffer,length, optionally frequency
    Serial.println(F("Sent signal."));
  }
}

I used this code with two working Ir transmitters, one with 2 pins and the other module with 3.
Both the transmitters are working I checked with my phone.
So when I point the transmitter to the device and trigger using ENTER nothing happens I checked the led with my phone camera it's working.
What did I miss?
Thanks.

Note: I tried IRremote library it shows UNKNOWN PROTOCOL so I used this library.

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