Devices & Components
Arduino Uno Rev3
IR receiver (generic)
JustBoom IR Remote
Jumper wires (generic)
RGB Diffused Common Cathode
Solderless Breadboard Full Size
Software & Tools
Arduino IDE
Project description
Code
Arduino IR remote RGB led code
c_cpp
copy 1 part for hex code and 2 part for the main project
1 2 // PART - 1 // 3 4#include <IRremote.h> 5 6int RECV_PIN = 11; 7 8IRrecv irrecv(RECV_PIN); 9 10decode_results results; 11 12void setup() 13{ 14 Serial.begin(9600); 15 // In case the interrupt driver crashes on setup, give a clue 16 // to the user what's going on. 17 Serial.println("Enabling IRin"); 18 irrecv.enableIRIn(); // Start the receiver 19 Serial.println("Enabled IRin"); 20} 21 22void loop() { 23 if (irrecv.decode(&results)) { 24 Serial.println(results.value, HEX); 25 irrecv.resume(); // Receive the next value 26 } 27 delay(100); 28} 29 30 31 32 33 // PART - 2 // 34 35 36 37#include <IRremote.h> 38 39int RECV_PIN = 11; 40 41IRrecv irrecv(RECV_PIN); 42decode_results results; 43 44int redled = 3; 45int greenled = 5; 46int blueled = 6; 47int m; 48 49void setup() { 50 // put your setup code here, to run once: 51pinMode(redled, OUTPUT); 52pinMode(greenled, OUTPUT); 53pinMode(blueled, OUTPUT); 54irrecv.enableIRIn(); 55} 56 57void loop() { 58 // put your main code here, to run repeatedly: 59if(irrecv.decode(&results)) 60{ 61 Serial.println(results.value,HEX); 62 irrecv.resume(); 63} 64 if(results.value == 0x1FE48B7 ) 65{ 66 m = 0; 67} 68 if(results.value == 0x1FE807F ) 69{ 70 m = 1; 71} 72 if(results.value == 0x1FE20DF ) 73{ 74 m = 2; 75} 76 77switch (m) 78{ 79 case 0: 80 { 81 digitalWrite(redled, HIGH); 82 digitalWrite(greenled,LOW); 83 digitalWrite(blueled,LOW); 84 return; 85 } 86 case 1: 87 { 88 digitalWrite(redled, LOW); 89 digitalWrite(greenled,HIGH); 90 digitalWrite(blueled,LOW); 91 return; 92 } 93 case 2: 94 { 95 digitalWrite(redled, LOW); 96 digitalWrite(greenled,LOW); 97 digitalWrite(blueled,HIGH); 98 return; 99 } 100} 101delay(100); 102}
Downloadable files
Arduino IR remote control RGB led
download
Arduino IR remote control RGB led
Arduino IR control RGB led
download pdf
Arduino IR control RGB led
Arduino IR remote control RGB led
download
Arduino IR remote control RGB led
Arduino IR control RGB led
download pdf
Arduino IR control RGB led
Comments
Only logged in users can leave comments