Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- int RECV_PIN = 6;
- 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(results.value,HEX);
- //Serial.println(results.bits,BIN);
- 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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement