Components and supplies
Arduino UNO
RGB Diffused Common Cathode
5 mm LED: Yellow
Resistor 221 ohm
IR Remote and Sensor
Project description
Code
The Code
arduino
Paste this into the Arduino code editor. Make sure to install the library IRremote if you have not already.
1/* The following program was written and created by O*** Ro******m - O'*****r, known anonomously by the username Lord Akil Imenand. 2 * The following code is only to be used for educational and private purposes. 3 * The pin setup is as follows: 4 * IR Reciever - Arduino: 5 * G - Grnd 6 * R - 5v 7 * Y - Digital 11(Eleven) 8 * Arduino - RGB LED: 9 * Grnd - cathode(long leg) 10 * Digital 2 - red leg (Alone next to the cathode) 11 * Digital 3 - green leg (Opposite the red leg, next to the cathode) 12 * Digital 4 - blue leg (Only one left) 13 * Arduino - Warning LED: 14 * Grnd - cathode(short leg) 15 * Digital 5 - anode (long leg) 16 * 17 * The controls are as follows: 18 * On button: white 19 * Func/Stop button: off 20 * Vol + button: red on 21 * Vol - button: red off 22 * Fast Forward button: green on 23 * Reverse button: green off 24 * Up button: blue on 25 * Down button: blue off 26 * EQ button: white 27 * 1: red 28 * 2: green 29 * 3: blue 30 * 4: yellow 31 * 5: purple 32 * 6: teal 33 * 7: red off 34 * 8: green off 35 * 9: blue off 36 * The pause, 0, and ST/Rept buttons don't do anything. 37 */ 38 39 40#include "IRremote.h" 41 42int receiver = 11; 43 44IRrecv irrecv(receiver); 45decode_results results; 46 47void translateIR() 48{ 49 50 switch(results.value) 51 52 { 53 case 0xFFA25D: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 54 case 0xFFE21D: digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); break; 55 case 0xFF629D: digitalWrite(2, HIGH); break; 56 case 0xFF22DD: digitalWrite(3, LOW); break; 57 case 0xFF02FD: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 58 case 0xFFC23D: digitalWrite(3, HIGH); break; 59 case 0xFFE01F: digitalWrite(4, LOW); break; 60 case 0xFFA857: digitalWrite(2, LOW); break; 61 case 0xFF906F: digitalWrite(4, HIGH); break; 62 case 0xFF9867: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 63 case 0xFFB04F: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 64 case 0xFF6897: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 65 case 0xFF30CF: digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); break; 66 case 0xFF18E7: digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, LOW); break; 67 case 0xFF7A85: digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, HIGH); break; 68 case 0xFF10EF: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, LOW); break; 69 case 0xFF38C7: digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, HIGH); break; 70 case 0xFF5AA5: digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 71 case 0xFF42BD: digitalWrite(2, LOW); break; 72 case 0xFF4AB5: digitalWrite(3, LOW); break; 73 case 0xFF52AD: digitalWrite(4, LOW); break; 74 case 0xFFFFFFFF: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 75 76 default: 77 digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); 78 79 }// End Case 80 81 delay(400); //How long to wait before giving repeat signal 82 83 84} //END translateIR 85void setup() 86{ 87 Serial.begin(9600); 88 Serial.println("IR Receiver Button Decode"); 89 irrecv.enableIRIn(); 90 pinMode(2, OUTPUT); 91 pinMode(3, OUTPUT); 92 pinMode(4, OUTPUT); 93 pinMode(5, OUTPUT); 94 digitalWrite(2, LOW); 95 digitalWrite(3, LOW); 96 digitalWrite(4, LOW); 97 digitalWrite(5, LOW); 98 99} 100 101 102void loop() 103{ 104 if (irrecv.decode(&results)) 105 106 { 107 translateIR(); 108 irrecv.resume(); 109 } 110} 111 112 113
The Code
arduino
Paste this into the Arduino code editor. Make sure to install the library IRremote if you have not already.
1/* The following program was written and created by O*** Ro******m - O'*****r, known anonomously by the username Lord Akil Imenand. 2 * The following code is only to be used for educational and private purposes. 3 * The pin setup is as follows: 4 * IR Reciever - Arduino: 5 * G - Grnd 6 * R - 5v 7 * Y - Digital 11(Eleven) 8 * Arduino - RGB LED: 9 * Grnd - cathode(long leg) 10 * Digital 2 - red leg (Alone next to the cathode) 11 * Digital 3 - green leg (Opposite the red leg, next to the cathode) 12 * Digital 4 - blue leg (Only one left) 13 * Arduino - Warning LED: 14 * Grnd - cathode(short leg) 15 * Digital 5 - anode (long leg) 16 * 17 * The controls are as follows: 18 * On button: white 19 * Func/Stop button: off 20 * Vol + button: red on 21 * Vol - button: red off 22 * Fast Forward button: green on 23 * Reverse button: green off 24 * Up button: blue on 25 * Down button: blue off 26 * EQ button: white 27 * 1: red 28 * 2: green 29 * 3: blue 30 * 4: yellow 31 * 5: purple 32 * 6: teal 33 * 7: red off 34 * 8: green off 35 * 9: blue off 36 * The pause, 0, and ST/Rept buttons don't do anything. 37 */ 38 39 40#include "IRremote.h" 41 42int receiver = 11; 43 44IRrecv irrecv(receiver); 45decode_results results; 46 47void translateIR() 48{ 49 50 switch(results.value) 51 52 { 53 case 0xFFA25D: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 54 case 0xFFE21D: digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); break; 55 case 0xFF629D: digitalWrite(2, HIGH); break; 56 case 0xFF22DD: digitalWrite(3, LOW); break; 57 case 0xFF02FD: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 58 case 0xFFC23D: digitalWrite(3, HIGH); break; 59 case 0xFFE01F: digitalWrite(4, LOW); break; 60 case 0xFFA857: digitalWrite(2, LOW); break; 61 case 0xFF906F: digitalWrite(4, HIGH); break; 62 case 0xFF9867: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 63 case 0xFFB04F: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 64 case 0xFF6897: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 65 case 0xFF30CF: digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); break; 66 case 0xFF18E7: digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, LOW); break; 67 case 0xFF7A85: digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, HIGH); break; 68 case 0xFF10EF: digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, LOW); break; 69 case 0xFF38C7: digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, HIGH); break; 70 case 0xFF5AA5: digitalWrite(2, LOW); digitalWrite(3, HIGH); digitalWrite(4, HIGH); break; 71 case 0xFF42BD: digitalWrite(2, LOW); break; 72 case 0xFF4AB5: digitalWrite(3, LOW); break; 73 case 0xFF52AD: digitalWrite(4, LOW); break; 74 case 0xFFFFFFFF: digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); break; 75 76 default: 77 digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); delay(20); digitalWrite(5, HIGH); delay(20); digitalWrite(5, LOW); 78 79 }// End Case 80 81 delay(400); //How long to wait before giving repeat signal 82 83 84} //END translateIR 85void setup() 86{ 87 Serial.begin(9600); 88 Serial.println("IR Receiver Button Decode"); 89 irrecv.enableIRIn(); 90 pinMode(2, OUTPUT); 91 pinMode(3, OUTPUT); 92 pinMode(4, OUTPUT); 93 pinMode(5, OUTPUT); 94 digitalWrite(2, LOW); 95 digitalWrite(3, LOW); 96 digitalWrite(4, LOW); 97 digitalWrite(5, LOW); 98 99} 100 101 102void loop() 103{ 104 if (irrecv.decode(&results)) 105 106 { 107 translateIR(); 108 irrecv.resume(); 109 } 110} 111 112 113
Downloadable files
Circuit Diagram
An easy way to look at the pin setup. You IR sensor module may be different, so make sure to connect the ground to ground, the vcc to 5v, and the output to pin eleven(11).
Circuit Diagram
Comments
Only logged in users can leave comments
Lord_Akil_Imenand
0 Followers
•1 Projects
0
1
Anonymous user
4 years ago
How to open BRD file.