Skip to content

Instantly share code, notes, and snippets.

@microcontrollershub
Last active February 18, 2018 18:39
Show Gist options
  • Save microcontrollershub/88c1f8c635399600aedcf6b223b36679 to your computer and use it in GitHub Desktop.
Save microcontrollershub/88c1f8c635399600aedcf6b223b36679 to your computer and use it in GitHub Desktop.
#include <IRremote.h>
const int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
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
Send_Command(); // Try sending some command
}
}
void Send_Command()
{
for (int i = 0; i < 5; i++) {
irsend.sendRC5(0x08B5, 13); // 08B9 is command for MUTE
delayMicroseconds(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment