Ramji Patel
Published © GPL3+

Arduino IR remote

Control LEDS with your TV remote

AdvancedProtip1,402
Arduino IR remote

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
IR receiver (generic)
×1
JustBoom IR Remote
JustBoom IR Remote
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Arduino IR remote control RGB led

download

Arduino IR control RGB led

download pdf

Code

Arduino IR remote RGB led code

C/C++
copy 1 part for hex code and 2 part for the main project
                                                                                //  PART - 1 //

#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  // In case the interrupt driver crashes on setup, give a clue
  // to the user what's going on.
  Serial.println("Enabling IRin");
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Enabled IRin");
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}




                                                                         //  PART - 2 //



#include <IRremote.h>

int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);
decode_results results;

int redled = 3;
int greenled = 5;
int blueled = 6;
int m;

void setup() {
  // put your setup code here, to run once:
pinMode(redled, OUTPUT);
pinMode(greenled, OUTPUT);
pinMode(blueled, OUTPUT);
irrecv.enableIRIn();
}

void loop() {
  // put your main code here, to run repeatedly:
if(irrecv.decode(&results))
{
  Serial.println(results.value,HEX);
  irrecv.resume();
}
 if(results.value == 0x1FE48B7   )
{
  m = 0;
}
 if(results.value == 0x1FE807F   )
{
  m = 1;
}
 if(results.value == 0x1FE20DF    )
{
  m = 2;
}

switch (m)
{
  case 0:
  {
    digitalWrite(redled, HIGH);
    digitalWrite(greenled,LOW);
    digitalWrite(blueled,LOW);
    return;
  }
  case 1:
  {
    digitalWrite(redled, LOW);
    digitalWrite(greenled,HIGH);
    digitalWrite(blueled,LOW);
    return;
  }
  case 2:
  {
    digitalWrite(redled, LOW);
    digitalWrite(greenled,LOW);
    digitalWrite(blueled,HIGH);
    return;
  }
}
delay(100);
}

Credits

Ramji Patel

Ramji Patel

26 projects • 18 followers
Myself Ramji Patel. I am an Engineering student and pursuing my B-Tech from Institute of engineering and rural Technology Prayagraj, India.

Comments