Last active
August 29, 2015 14:12
-
-
Save erikaheidi/9d0bb9746acdeee9cdd0 to your computer and use it in GitHub Desktop.
Arduino IRremote with generic keychan 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
/* | |
* DEMO IRremote Receive using the retired generic keychan remote control form Sparkfun | |
* https://www.sparkfun.com/products/retired/10280 | |
* | |
* IR Receiver on PIN 2 | |
* @author Erika Heidi | |
*/ | |
#include <IRremote.h> | |
int RECV_PIN = 2; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
/* | |
* Codes for generic keychan remote control | |
*/ | |
const long KEY_POWER = 0x670217CF; | |
const long KEY_CHAN_UP = 0x44AFEFA5; | |
const long KEY_CHAN_DOWN = 0x6913D8B; | |
const long KEY_MUTE = 0xFEBDC009; | |
const long KEY_VOL_UP = 0xD04D698F; | |
const long KEY_VOL_DOWN = 0X2B2FE82D; | |
const long KEY_AV = 0XD3956A2F; | |
void setup() | |
{ | |
Serial.begin(9600); | |
irrecv.enableIRIn(); // Start the receiver | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
switch (results.value) { | |
case KEY_POWER: | |
Serial.println("POWER pressed"); | |
break; | |
case KEY_CHAN_UP: | |
Serial.println("CHAN UP pressed"); | |
break; | |
case KEY_CHAN_DOWN: | |
Serial.println("CHAN DOWN pressed"); | |
break; | |
case KEY_MUTE: | |
Serial.println("MUTE pressed"); | |
break; | |
case KEY_VOL_UP: | |
Serial.println("VOL UP pressed"); | |
break; | |
case KEY_VOL_DOWN: | |
Serial.println("VOL DOWN pressed"); | |
break; | |
case KEY_AV: | |
Serial.println("AV/TV pressed"); | |
break; | |
} | |
irrecv.resume(); // Receive the next value | |
} | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment