IR Receiver trouble

Good afternoon people, I'm having a seriously problem with arduino IR Transmissor, I've a LG Television and I want to turn on/off it, I got the receiver and got the ON/OFF code as shown below:

Encoding : NEC
Code : 20DFC03F (32 bits)
Timing[67]:
+9050, -4450 + 550, - 550 + 600, - 550 + 550, -1700
+ 550, - 600 + 550, - 550 + 600, - 550 + 550, - 550
+ 600, - 550 + 600, -1650 + 600, -1650 + 600, - 550
+ 550, -1700 + 550, -1700 + 550, -1700 + 550, -1700
+ 550, -1700 + 550, -1700 + 550, -1700 + 550, - 550
+ 600, - 550 + 600, - 550 + 550, - 550 + 600, - 550
+ 600, - 550 + 550, - 550 + 600, - 550 + 550, -1700
+ 600, -1650 + 600, -1650 + 600, -1650 + 600, -1650
+ 600, -1650 + 600
unsigned int rawData[67] = {9050,4450, 550,550, 600,550, 550,1700, 550,600, 550,550, 600,550, 550,550, 600,550, 600,1650, 600,1650, 600,550, 550,1700, 550,1700, 550,1700, 550,1700, 550,1700, 550,1700, 550,1700, 550,550, 600,550, 600,550, 550,550, 600,550, 600,550, 550,550, 600,550, 550,1700, 600,1650, 600,1650, 600,1650, 600,1650, 600,1650, 600}; // NEC 20DFC03F
unsigned int data = 0x20DFC03F;

So, the code to turn it on is: 20DFC03F, it have 32 bits and the decodification is NEC, then I put my IR Led in pins:

Positive -> (Digital Pin 3 + 4.7kOhms resistor)
Negative -> (Ground)

And I used the code:

#include <IRremote.h>

IRsend irsend;

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

void loop() {
      irsend.sendNEC(0x20DF10EF,32);
      delay(3000);
}

So, it should turn the television on and off every 3 seconds BUT it doesn't, the pins seens to be ok (I use ATMega2560 board), the code seens to be ok, I got the library in correct place...

I made some testes to see if the led was working, when I use output,HIGH or output,LOW, I can see with my camera the led working but with the code above it doesn't blink (I don't know if I it blinks fast or if the code is not working)

My question is, what's wrong with my code/schematic? Did I made a mistake in the code? Or in pin usage?

Thanks a lot! Heitor.

The code you're sending isn't the same as the one received.

When you get that part fixed, a 4.7K resistor is driving the IR emitter very weakly. It should likely be 220 ohms, for any IR emitter that I've ever seen.

Martin-X:
The code you're sending isn't the same as the one received.

What's the correct code? What am I doing wrong?

aarg:
When you get that part fixed, a 4.7K resistor is driving the IR emitter very weakly. It should likely be 220 ohms, for any IR emitter that I've ever seen.

I saw some schematics with 5k resistor, so, a 220ohms resistor won't damage my IR, right?

(deleted)

spycatcher2k:
You tell us
and write
Take a guess at what the correct code is!!!!

Oh, but this a code from another button (Volume +). It's ok, but thanks for helping

(deleted)

Good to know that, can I check it in library? How do I know the correct pin?

(deleted)

(deleted)

Hbadotti:
I saw some schematics with 5k resistor, so, a 220ohms resistor won't damage my IR, right?

Link to the schematics? Link to the IR?

spycatcher2k:

Ok, I changed the from pin 3 to pin 9 and changed the resistor from 4.7k to 1k and still doesn't works...

Are you certain of the LED polarity? You can see IR from the emitter with some cameras and cell phone cameras.

aarg:
Are you certain of the LED polarity? You can see IR from the emitter with some cameras and cell phone cameras.

Yes, I'm sure, as I said, it turn on when I use "output, high", I can see the with my camera...

Hbadotti:
Yes, I'm sure, as I said, it turn on when I use "output, high", I can see the with my camera...

So, does it blink when driving it with the code?

aarg:
So, does it blink when driving it with the code?

It blinks when I make a custom code, like "Blinking" example, but when I use that code / , it doesn't blink.

#include <IRremote.h>

IRsend irsend;

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

void loop() {
irsend.sendNEC(0x20DF10EF,32);
delay(3000);
}

(deleted)

spycatcher2k:
Run the code, and move the emitter from pin to pin until you get a signal. Or post the library here for us to look at.

I looked into the library, and it says pin 9 for arduino atmega, but I'll do that when I get home.

The fact that pin 9 is used on the Mega and pin 3 on the Uno makes good sense, because they are both connected to OC2B on the processor.