IR led transmit problem

Hello all,

noob programmer here with a little knowledge in electronics though. I’m trying to decode my Sony’s Ir remote control with Ken Shirriff’s library. I used his IRrecvDump example and got this code when I was pressing button no.1 :

10
Decoded SONY: 10 (12 bits)
Raw (26): 17400 2450 -500 650 -550 650 -500 650 -550 650 -500 700 -500 650 -550 650 -500 1300 -500 650 -500 700 -500 650 -500 700

and put them all down here :
#include <IRremote.h>

IRsend irsend;

// just added my own array for the raw signal
unsigned int powerOn[26] = {2450,500,650,550,650,500,650,550,650,500,700,500,650,550,650,500,1300,500,650,500,700,500,650,500,700};

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

void loop() {

// altered the code just to send/test my raw code
irsend.sendRaw(powerOn,26,38);
delay(100);

}

I tried different methods but nothing seems to work.
A) checked if the IR leds flash through a camera and they flash
B) changed the frequency to 40 Khz but nothing happened
C) After void loop I wrote a for loop so that the signals could be sent 3 times (something I read in a different site for Sony TVs). Am I missing something here?

Why are there minus signs in the raw decoded signal but not in your code?

Do you really need to send raw data as the protocol has been decoded to be 12 bit Sony code 0x10.

Does irsend.sendSony(0x10, 12); not do the same thing?

Sacha22: Why are there minus signs in the raw decoded signal but not in your code?

Well I read an article and it said that the minus signs shouldn't be at the code, also the first number (17400 in my case) shouldn't be either cause it's a time for the IR to warm.

Riva: Do you really need to send raw data as the protocol has been decoded to be 12 bit Sony code 0x10.

Does irsend.sendSony(0x10, 12); not do the same thing?

Hello my friend the truth is that I've tried but I didn't put 0x but only just 10 so it was something like that : irsend.sendSony(10, 12); I know that it should be a hex value and it's a mistake from me. Anyway I tried my way on another tv and all worked like a charm, so it has to be something with the brand of Sony, I guess, but first i'll try to send the codes like hex as you say and not raw codes

Try the following:

unsigned int powerOn[] = {2450,500,650,550,650,500,650,550,650,500,700,500,650,550,650,500,1300,500,650,500,700,500,650,500,700};
     
 irsend.sendRaw(powerOn,sizeof(powerOn)/sizeof(powerOn[0]),40);
      delay(26);

Explanation: - you have 25 elements in the array...not 26 - IRremote sometimes adds in a spurious value at the start, which you correctly removed, but did not adjust the count. - The SONY modulation frequency is usually 40 kHz - As mentioned the signal is repeated 3 times with a circa 26 millsecond delay in between - You need to complete the code above to send it 3 times. Then you should stop for at least several seconds as continuously sending a signal may swamp the TV receiver.

As already posted you can just use

irsend.sendSONY(0x010,12);

to send this signal

Finally, point the top of IRLED directly at the TV and bring it closer if neccesssary. (Read the common pitfalls via my signature)

Dear friends, thank you very much for the help, it seems that the hex code trick worked fine for my tv this time and I didn’t had to modify the raw codes, anyway thank you for the help and for providing me this wonderful information.