davidproelectro
Published © GPL3+

IR Controlled Three Led´s

This project is about controlling many led´s with IR controller.

BeginnerFull instructions provided71
IR Controlled Three Led´s

Things used in this project

Hardware components

LED (generic)
LED (generic)
There can be more or less of them.
×3
Jumper wires (generic)
Jumper wires (generic)
×14
Arduino UNO
Arduino UNO
Can be any arduino
×1
Resistor 10k ohm
Resistor 10k ohm
×3
Infrared Receiver, Remote Control
Infrared Receiver, Remote Control
×1

Story

Read more

Code

This is the final code.

Arduino
#include <IRremote.h>

int IRpin = 11;
int ledpin = 6;
int ledpin_2 = 5;
int ledpin_3 = 4;
IRrecv irrecv(IRpin);
decode_results results;

void setup()
{
Serial.begin(9600);  //open the serial port
irrecv.enableIRIn(); // start receiving data
pinMode(ledpin, OUTPUT);
pinMode(ledpin_2, OUTPUT);
pinMode(ledpin_3, OUTPUT);//define LED as output
}

void loop()
{
if (irrecv.decode(&results)) {
Serial.println(results.value, DEC); //print the value

if(results.value==16754775) // your value here
        {
           digitalWrite(ledpin, HIGH);   // turn the LED on
                   
        }
if(results.value==16769055) // your value here
        {
           digitalWrite(ledpin, LOW);   // turn the LED off
                       
        }
if(results.value==16712445) // your value here
        {
           digitalWrite(ledpin_2, HIGH);   // turn the LED on
                   
        }
if(results.value==16720605) // your value here
        {
           digitalWrite(ledpin_2, LOW);   // turn the LED off
                       
        }
if(results.value==16736925) // your value here
        {
           digitalWrite(ledpin_3, HIGH);   // turn the LED on
                   
        }
if(results.value==16753245) // your value here
        {
           digitalWrite(ledpin_3, LOW);   // turn the LED off
                       
        }


irrecv.resume(); // receive the next value
}
}

Credits

davidproelectro

davidproelectro

0 projects • 0 followers

Comments