Created
July 17, 2014 19:34
-
-
Save Robotonics/9b956eb356552ecc6dfb to your computer and use it in GitHub Desktop.
Arduino IRremote library usage with cheap 20 button IR remote from Xinda
This file contains hidden or 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> | |
int RECV_PIN = 11; | |
IRrecv irrecv(RECV_PIN); | |
decode_results results; | |
void setup() | |
{ | |
Serial.begin(9600); | |
irrecv.enableIRIn(); // Start the receiver | |
} | |
void loop() { | |
if (irrecv.decode(&results)) { | |
if(results.value==0xff629d){ | |
Serial.println("UP"); | |
} | |
if(results.value==0xffa857){ | |
Serial.println("DOWN"); | |
} | |
if(results.value==0xff22dd){ | |
Serial.println("LEFT"); | |
} | |
if(results.value==0xffc23d){ | |
Serial.println("RIGHT"); | |
} | |
if(results.value==0xff02fd){ | |
Serial.println("OK"); | |
} | |
if(results.value==0xFF6897){ | |
Serial.println("1"); | |
} | |
if(results.value==0xFF9867){ | |
Serial.println("2"); | |
} | |
if(results.value==0xffB04F){ | |
Serial.println("3"); | |
} | |
if(results.value==0xff30CF){ | |
Serial.println("4"); | |
} | |
if(results.value==0xFF18E7){ | |
Serial.println("5"); | |
} | |
if(results.value==0xff7A85){ | |
Serial.println("6"); | |
} | |
if(results.value==0xff10EF){ | |
Serial.println("7"); | |
} | |
if(results.value==0xff38C7){ | |
Serial.println("8"); | |
} | |
if(results.value==0xff5AA5){ | |
Serial.println("9"); | |
} | |
if(results.value==0xff4AB5){ | |
Serial.println("0"); | |
} | |
if(results.value==0xff42BD){ | |
Serial.println("*"); | |
} | |
if(results.value==0xff52AD){ | |
Serial.println("#"); | |
} | |
irrecv.resume(); // Receive the next value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment