Skip to content

Instantly share code, notes, and snippets.

@JeremySCook
Last active May 12, 2020 20:47
Show Gist options
  • Save JeremySCook/45515bc060c6c77101367f7916f18e53 to your computer and use it in GitHub Desktop.
Save JeremySCook/45515bc060c6c77101367f7916f18e53 to your computer and use it in GitHub Desktop.
pick out different remotes example
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
* modified for light indicator and response to different buttons JSCook 5/12/2020
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
digitalWrite(LED_BUILTIN, HIGH);
Serial.println(results.value, HEX); //will tell you codes regardless of remote
switch(results.value){
case 0x100BCBD:{ //program in your particular buttons as needed
Serial.println("Panasonic power button");
break;
}
case 0xC1C7C03F:{ //program in your particular buttons as needed
Serial.println("Canon start/stop button");
break;
}
case 0x1009293:{ //program in your particular buttons as needed
Serial.println("Panasonic OK button");
break;
}
default: {
Serial.println("Unknnown code");
break;
}
}
delay(250);
irrecv.resume(); // Receive the next value
digitalWrite(LED_BUILTIN, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment