Shirriff's IRremote library not working. Led doesn't emit. [SOLVED]

Hello, I’ve not found any real alternative to this library, and it seems that it doesn’t work for me. The hardware setup is fine: emitter led connected to pin 3 and working if used as a normal led with “blink” example. When I load the “IRsendDemo” example from this library, the led does nothing, it does not turn on either. I tried using

irsend.sendSony() and irsend.sendNEC() with multimple configurations, and nothing could at least turn on the emitter. What’s the problem? Any alternative to this library?

I must point out that the IRreceive example did actually work with my IR receiver.

Thank you.

EDIT: Here’s the solution

Can you clarify what type of LED you are using ? If it is an IR LED how do you know that it is not working ? If it is a standard LED, which seems likely from your description, what are you expecting to see ?

It's an IR led, bought there:

I see if it works using a camera.

This may be a stupid question, but are you are entering something in the serial monitor when running the program ?

Yes, I tried entering things in the Serial monitor, and tried not doing it. I also tried to erase the

  if ( != -1) {
    for (int i = 0; i < 3; i++) {

And let the code like:

#include <IRremote.h>

IRsend irsend;

void setup()


void loop() {
      irsend.sendSony(0xa90, 12); // Sony TV power code

Still nothing happens.

This sounds like a hardware or wiring problem. Have you removed and reconnected the LED since you tried it with the Blink sketch ? When did you last try it with the Blink sketch using pin 3 ?

No, I didn’t. I loaded the blink sketch, watched if it worked (it did), and one minute later, without touching anything, loaded the IRsendDemo and later experimented with variations of the sketch.

You're using a resistor ?

Ir leds are power hungry and will happily damage your arduino pins without one....

Yes, of course. I'm using a variable resistor, set on idk how many ohms, just turned it to the point where the led is not so dim and not so bright.


First of all IRremote is very robust and has been used successfully many times by people with all levels of experience. I made a silly mistake a couple of days ago when using it, myself.

Try the following

void loop() {
        irsend.sendSony(0xa90, 12); // Sony TV power code

It may be that sending just one burst every second isnt enough to show up on your camera with this LED. The code above will send an IR command 5 times evey second and may show up brighter on your phone. There is no need to let it run for more than a few seconds. If you are not using a transistor, you will typically get very short range with IR.

If that doesnt work, confirm you have the LED wired the correct way and then let us know how you get on & maybe upload a sketch of your circuit.

Thank you, but it still doesn’t work =(

It’s wired correctly since it totally works with the blink example. This is the scheme (note that the trimpot here just works as a variable resistor):

The longer lead of the IR LED is +ve and the shorter lead is -ve. So for your layout make sure the shorter one is connected to GND.

Judging from your diagram, you may have it the wrong way around. So review your LED connection and change if I am correct.

Another problem may be that the resistance in the trimpot could be too large. Did you measure it?

I've checked and double-checked it, it's well connected. The resistance isn't too large, I didn't measure it, but when I loaded the blink sketch I adjusted it for being bright enough.

I didn't mean a good connection, I meant connected in reverse. Did you confirm that the shot lead/pin of the IR LED is connected to GND?

If that doesn't work replace the IR led with a normal LED (red, yellow, or green etc). This will allow a visible check to confirm if the IR LED is defective.

After, that you may need to use an oscilloscope or other test equipment to verify if the signal is being sent or if the LED is defective.

Just realised from your photo that you may be using an Arduino MEGA of some sort. There may be issues with that. Check the following post, in case you have to change the pin for Tx.,28434.0.html

Thank you, thank you very much!!!! This post on your link solved my problem Works perfectly now!