Skip to content

Instantly share code, notes, and snippets.

@joni2back
Forked from jeje/gist:3027236
Created September 4, 2018 17:42
Show Gist options
  • Save joni2back/1136708e1a0dc6f7b018778fb973c8ef to your computer and use it in GitHub Desktop.
Save joni2back/1136708e1a0dc6f7b018778fb973c8ef to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment