Created
October 29, 2018 14:51
-
-
Save gigafide/9108198a5543e6fe0b086e6b583d94bd to your computer and use it in GitHub Desktop.
Reads IR code signals from a remote control
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> | |
const int RECV_PIN = 11; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
void setup() | |
{ | |
Serial.begin(9600); | |
irrecv.enableIRIn(); // Start the receiver | |
irrecv.blink13(true); | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
if (results.decode_type == NEC) { | |
Serial.print("NEC: "); | |
} else if (results.decode_type == SONY) { | |
Serial.print("SONY: "); | |
} else if (results.decode_type == RC5) { | |
Serial.print("RC5: "); | |
} else if (results.decode_type == RC6) { | |
Serial.print("RC6: "); | |
} else if (results.decode_type == UNKNOWN) { | |
Serial.print("UNKNOWN: "); | |
} | |
Serial.println(results.value, HEX); | |
irrecv.resume(); // Receive the next value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment