TV remote control

Hello
I need a little help, I have removed the code from the control of my TV, but I do not know how to make an LED-Infrared send that signal to turn it on, using the serial monitor dialog box.
this is my control code for the ignition.

ON/OFF

Encoding : SONY
Code : A90 (12 bits)
Timing[25]:
+2450, - 550 +1250, - 500 + 600, - 600 +1200, - 550

  • 600, - 550 +1250, - 500 + 650, - 550 + 600, - 550
    +1250, - 500 + 650, - 550 + 600, - 550 + 650, - 550
  • 600
    unsigned int rawData[25] = {2450,550, 1250,500, 600,600, 1200,550, 600,550, 1250,500, 650,550, 600,550, 1250,500, 650,550, 600,550, 650,550, 600}; // SONY A90
    unsigned int data = 0xA90;

:frowning:

Install the IRremote library and examine the examples. Select Sketch->Include Library->Manage Libraries... and put IRremote in the 'Filter your search...' field. Click on "IRremote by shirriff" and then the "Install" button that appears.

I tried with the RAW protocol and with Sony, but it only turns on the tv and it does not give me more commands like increase or decrease volume and it does not turn off: /

#include <IRremote.h>

IRsend irsend;
unsigned int Sony[25] = {2450,550, 1250,500, 600,600, 1200,550, 600,550, 1250,500, 650,550, 600,550, 1250,500, 650,550, 600,550, 650,550, 600};
unsigned int Sony2[25] = {2450,500, 650,550, 1200,500, 650,550, 650,550, 1250,500, 600,600, 600,550, 1250,550, 600,550, 650,500, 650,550, 650};
unsigned int Air[23] = {1300,350, 1350,350, 450,1200, 1300,350, 1300,400, 450,1200, 450,1200, 500,1150, 500,1200, 450,1200, 450,1200, 1300};

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

void loop() {

switch (Serial.read()) {
case ‘a’:{
irsend.sendSony(Sony, 25, 38);
Serial.println(“On”);

break;
}
case ‘b’:{
irsend.sendRaw(Sony2, 25, 12);
Serial.println(“Volp”);

break;
}
case ‘c’:{
irsend.sendSony(0xC90, 12);
Serial.println(“Vold”);

break;
}
case ‘d’:{
irsend.sendRaw(Air, 23, 32);
Serial.println(“VOLP”);
break;
}
case ‘e’:{
// irsend.sendNEC(0xFF18E7, 32);
Serial.println(“VOLD”);
delay(100);
}
case ‘f’:{
// irsend.sendNEC(0x20DFA857, 32);
Serial.println(“Canal 5”);
break;
}
case ‘g’:{
// irsend.sendNEC(0x20DF6897, 32);
Serial.println(“Canal 6”);
break;
}
case ‘h’:{
// irsend.sendNEC(0x20DFE817, 32);
Serial.println(“Canal 7”);
break;
}
case ‘i’:{
// irsend.sendNEC(0x20DF18E7, 32);
Serial.println(“Canal 8”);
break;
}
case ‘j’:{
// irsend.sendNEC(0x20DF9867, 32);
Serial.println(“Canal 9”);
break;
}
case ‘l’:{
// irsend.sendNEC(0x20DF10EF, 32);
Serial.println(“Ligando…ou… Desligando”);
delay(100);
break;
}
case ‘m’:{
// irsend.sendNEC(0x20DFC03F, 32);
Serial.println(“Vol -”);
delay(100);
break;
}
case ‘n’:{
// irsend.sendNEC(0x20DF40BF, 32);
Serial.println(“Vol +”);
delay(100);
break;
}
case ‘p’:{
// irsend.sendNEC(0x20DF00FF, 32);
Serial.println(“CH+”);
delay(100);
break;
}
case ‘q’:{
// irsend.sendSony(0x20DF807F, 32);
Serial.println(“CH-”);
delay(100);
break;
}
}

}

The third argument of irsend.sendraw() is the carrier frequency in kHz. Does Sony really use a 12 kHz or 32 kHz carrier? Typical values are 36 to 40. Use 38 if you don't know a better number. Using the correct number will give better range since the receiver is trying to filter out other carriers.

I tried with the RAW protocol and with Sony, but it only turns on the tv and it does not give me more commands like increase or decrease volume and it does not turn off:

I don't see an OFF code in your sketch.