Control your LEDs with TV or IR Remote



In this tutorial we will learn how to control our LEDs with using TV or IR remote.
After this tutorial, you can control everything with your TV or IR remote.

---

Hardware Required :

Arduino Board -https://goo.gl/Rqc5w2
IR Receiver Module Kit - https://goo.gl/PwBgFm
IR Sensor Only Receiver - https://goo.gl/hWqnJ7
220ohm Resistor - https://goo.gl/FVgEyR
Breadboard - https://goo.gl/GjpqVW
CR2025 Coin Battery - https://goo.gl/ot2BJz

Recommended Site - https://goo.gl/HDkZBt

---

About IR :

Infrared (IR) controls are often used in most electronic devices.
This LED will give a predefined code when we press any key on the remote control and a certain frequency will also flash.
The 38 kHz infrared receiver we use in the project demodulates the signal it receives and sends the button code to the Arduino.
We can use with this receiver as long as different brand and model remote controls have 38 kHz carrier signal.
The receiver has 3 pins. These are GND - VCC - Signal respectively.

---

About Hex code :

First we must find the hex codes of the buttons of remote controller.
This way you can use another remote control instead of the included in the kit.
So if you have only receiver, you can use any TV remote control.
We will use the IRrecvDump example code.

---

Download IR library :


Uncompress the ZIP or RAR file onto your desktop
Place the folder into your arduinosketchfolder/libraries folder
Rename the uncompressed folder IRremote

---

Get the Code :
#include <IRremote.h>

int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;

#define BUTTON_1 0x1
#define BUTTON_2 0x2
#define BUTTON_3 0x3
#define BUTTON_0 0x33
#define BUTTON_OK 0x35

int blue_LED = 7;
int red_LED = 6;
int green_LED = 5;


void setup()
{
  pinMode(blue_LED, OUTPUT);
  pinMode(red_LED, OUTPUT);
  pinMode(green_LED, OUTPUT);
  
  irrecv.enableIRIn();
}
void loop() {

  if (irrecv.decode(&results))
  {
    if (results.value == BUTTON_0)
    {
      digitalWrite(blue_LED, LOW);
      digitalWrite(red_LED, LOW);
      digitalWrite(green_LED, LOW);
    }
    if (results.value == BUTTON_OK)
    {
      digitalWrite(blue_LED, HIGH);
      digitalWrite(red_LED, HIGH);
      digitalWrite(green_LED, HIGH);
    }
    if (results.value == BUTTON_1)
    {
      digitalWrite(blue_LED, HIGH);
    }
    if (results.value == BUTTON_2)
    {
      digitalWrite(red_LED, HIGH);
    }
    if (results.value == BUTTON_3)
    {
      digitalWrite(green_LED, HIGH);
    }
    irrecv.resume();
  }
}