Devices & Components
Arduino Uno Rev3
IR Reciever (VS1838)
Jumper wires (generic)
Software & Tools
Arduino IDE
Project description
Code
First Part
arduino
After uploading this to the arduino, you should open the serial monitor (Tools), and press any button in the remote, (this should give you something like this "FD08F7"). After doing this with every button, we can get to the next part.
1#include <IRremote.h> 2 3const int RECV_PIN = 7; 4IRrecv irrecv(RECV_PIN); 5decode_results results; 6 7void setup(){ 8 Serial.begin(9600); 9 irrecv.enableIRIn(); 10} 11 12void loop(){ 13 if (irrecv.decode(&results)){ 14 Serial.println(results.value, HEX); 15 irrecv.resume(); 16 } 17} 18
Second Part
arduino
Here, You will be able to replace my remote values with yours to make it easier to see wich button you are pressing, and more organized for future projects. Note: Before adding your HEX code, you will have to add a "0x" just as it is done in row 20, 23, etc After doing this and uploading this code, instead of getting HEX values in your serial monitor, you should get what button you pressed
1#include <IRremote.h> 2 3const int RECV_PIN = 7; 4IRrecv irrecv(RECV_PIN); 5decode_results results; 6unsigned long key_value = 0; 7 8void setup(){ 9 Serial.begin(9600); 10 irrecv.enableIRIn(); 11} 12 13void loop(){ 14 if (irrecv.decode(&results)){ 15 16 if (results.value == 0XFFFFFFFF) 17 results.value = key_value; 18 19 switch(results.value){ 20 case 0xFD00FF: 21 Serial.println("ON / OFF"); 22 break; 23 case 0xFD807F: 24 Serial.println("VOL+"); 25 break; 26 case 0xFD40BF: 27 Serial.println("FUNC / STOP"); 28 break; 29 case 0xFD20DF: 30 Serial.println("|<<"); 31 break; 32 case 0xFDA05F: 33 Serial.println(">||"); 34 break ; 35 case 0xFD609F: 36 Serial.println(">>|"); 37 break ; 38 case 0xFD10EF: 39 Serial.println(""); 40 break ; 41 case 0xFD906F: 42 Serial.println("VOL-"); 43 break ; 44 case 0xFD50AF: 45 Serial.println(""); 46 break ; 47 case 0xFD30CF: 48 Serial.println("0"); 49 break ; 50 case 0xFDB04F: 51 Serial.println("EQ"); 52 break ; 53 case 0xFD708F: 54 Serial.println("ST / REPT"); 55 break ; 56 case 0xFD08F7: 57 Serial.println("1"); 58 break ; 59 case 0xFD8877: 60 Serial.println("2"); 61 break ; 62 case 0xFD48B7: 63 Serial.println("3"); 64 break ; 65 case 0xFD28D7: 66 Serial.println("4"); 67 break ; 68 case 0xFDA857: 69 Serial.println("5"); 70 break ; 71 case 0xFD6897: 72 Serial.println("6"); 73 break ; 74 case 0xFD18E7: 75 Serial.println("7"); 76 break ; 77 case 0xFD9867: 78 Serial.println("8"); 79 break ; 80 case 0xFD58A7: 81 Serial.println("9"); 82 break ; 83 } 84 key_value = results.value; 85 irrecv.resume(); 86 } 87} 88
First Part
arduino
After uploading this to the arduino, you should open the serial monitor (Tools), and press any button in the remote, (this should give you something like this "FD08F7"). After doing this with every button, we can get to the next part.
1#include <IRremote.h> 2 3const int RECV_PIN = 7; 4IRrecv irrecv(RECV_PIN); 5decode_results 6 results; 7 8void setup(){ 9 Serial.begin(9600); 10 irrecv.enableIRIn(); 11} 12 13void 14 loop(){ 15 if (irrecv.decode(&results)){ 16 Serial.println(results.value, 17 HEX); 18 irrecv.resume(); 19 } 20} 21
Downloadable files
Setup .fzz file
If you want to change it or something, i'll leave the .fzz file here
Setup .fzz file
Schematics
Even though the IR reciever in the diagram is not the one I'm using, it's the only one I found in Fritzing, i'm using a VS1838
Schematics

Setup .fzz file
If you want to change it or something, i'll leave the .fzz file here
Setup .fzz file
Schematics
Even though the IR reciever in the diagram is not the one I'm using, it's the only one I found in Fritzing, i'm using a VS1838
Schematics

Comments
Only logged in users can leave comments