Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arduino Sketch recording raw IR signal and sending it through an infrared LED again every 2 seconds
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
boolean recording = true;
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (recording) {
if (irrecv.decode(&results)) {
Serial.println("IR code recorded!");
//irrecv.resume(); // Receive the next value
Serial.print("Recorded ");
Serial.print(results.rawlen);
Serial.println(" intervals.");
recording = false;
}
} else {
// replay mode
Serial.println("Sending recorded IR signal!");
irsend.sendRaw((unsigned int*) results.rawbuf, results.rawlen, 38);
delay(2000);
}
}
@jackbell16

This comment has been minimized.

Copy link

@jackbell16 jackbell16 commented Feb 8, 2014

Hi,
thank you for sharing this Arduino code on Github. I was trying to switch on my TV with Arduino. The code you posted is able to get the code and try to re-send, but the TV doesn't switch on. The IR LED light every 2 seconds. What do you think is the problem ? Should I insert any resistor from the PIN 3 to the IR LED ? I hope to hear you back.

@ivahen

This comment has been minimized.

Copy link

@ivahen ivahen commented Oct 14, 2015

I want to know too. that doesnt work for me. capture but doesnt send any data

@matthinc

This comment has been minimized.

Copy link

@matthinc matthinc commented Oct 29, 2015

It's receiving but not sending - (I use a couple of transistors, because I have a lot of IR LED's in my project)

@DigitAlchemies

This comment has been minimized.

Copy link

@DigitAlchemies DigitAlchemies commented Aug 13, 2017

For those who are able to receive and not send, though this might be obvious, check if you have an IR transmitter sensor module/support. If it's only an IR receiver sensor module you have, sending the IR codes back on a certain pin, after receiving will be just of no use! I am saying this from my earlier experience when I started playing with them! :) Cheers.

@chamithchathuka

This comment has been minimized.

Copy link

@chamithchathuka chamithchathuka commented Jan 14, 2018

@RaghavanSanthanam could you pls mention the pin mapping for the ir send code

@GANESHBANDI9948

This comment has been minimized.

Copy link

@GANESHBANDI9948 GANESHBANDI9948 commented Apr 20, 2018

hello everyone, iam doing a project i.e using ir remote codes to control the consumer products using arduino, ir receiver and ir led. i controlled the NEC protocol products but i didn't control the SAMSUNG protocol devices .i want control the LLOYD AC .it has SAMSUNG protocol .can you please help me.
thank you.

@Atlanta11

This comment has been minimized.

Copy link

@Atlanta11 Atlanta11 commented Oct 1, 2018

It is recieving and sending but it don't switch my Panasonic tv.

@majidmp97

This comment has been minimized.

Copy link

@majidmp97 majidmp97 commented Oct 5, 2018

send pin ??!!

@majidmp97

This comment has been minimized.

Copy link

@majidmp97 majidmp97 commented Oct 5, 2018

send pin is pin3 un uno328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment