Sending out IR signals using arduino.

Hello
I recently purchased some LED strips for my office. The result is great but i keep losing the remote. So i want to make a simple circuit to send out the IR code for the “OFF” button using a sensor to activate it. By attaching an IR sensor to an arduino uno i pressed the off button of the remote and got the following codes: "19:47:31.920 → FF02FD
19:47:31.988 → FFFFFFFF " I’m pretty sure the last one isent necessary to add to the code. and i also got the type “NEC” I attached an IR diode to an arduino uno to try and sens out this code to the sensor of the LED strip but its not turning off. I tried changing the bits from 12 to 32 pressing the diode on the sensor But nothing. Using my phone i can see the diode is turning on. This is the code im using.
#include <IRremote.h>

IRsend irsend;

void setup()
{
}

void loop() {
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xFF02FD, 12);
delay(40);
}
delay(5000);
}

And this is the circuit: (i did attach a resistor to it) I have seen some people using 2N222 transistors (i have those) But i dont what the purpose is for them in the circuit…
If anyone could help me with this that would be awsome!
Thanks!


Never, ever connect a diode directly to an Arduino digital output. The excess current can damage the IC. The base resistor in the 2N2222 circuit prevents this, and the transistor also amplifies the current so that the diode can be driven with nearly its rated maximum - which is much higher for a typical IR transmitter LED than for a typical display LED.

Don't only test your device with one receiver. Get it going first with something else like a TV to verify the hardware.

I just tested it by using another arduino to test the output and i get the same code as when i use the remote… I’m guessing its somthing to do with the code?

EDIT: i figured it out

I needed to change the code to: "irsend.sendNEC(0xFF02FD, 32);"
Kinda stupid i looked over that too be honest