Created
March 27, 2017 12:00
-
-
Save biacz/d1255d44841736e09f1234d0e4418cae to your computer and use it in GitHub Desktop.
receiver.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <IRremote.h> | |
int RECV_PIN = 11; | |
IRrecv irrecv(RECV_PIN); | |
IRsend irsend; | |
boolean recording = true; | |
decode_results results; | |
void setup() | |
{ | |
Serial.begin(115200); | |
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(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