loading

//First Write Down Note Detact Remote Code

#include #include

int RECV_PIN = 3;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver }

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

Step 1: Second Apply Remote Code

//Second Apply Remote Code Plz Add Library

#include
#include

int RECV_PIN = 3;

int output1 = 9;int output2 = 10;int output3 = 11;int output4 = 12;

int LedState[] = {0,0,0,0,0};

#define code1 0x202807F

#define code2 0x20240BF

#define code3 0x202C03F

#define code4 0x20220DF

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

Serial.begin(9600);

irrecv.enableIRIn();

pinMode(output1, OUTPUT);pinMode(output2, OUTPUT);pinMode(output3, OUTPUT);pinMode(output4, OUTPUT);

}

void loop() {

if (irrecv.decode(&results))

{ unsigned int value = results.value; switch(value) {

case code1: if(LedState[1] == 1) { digitalWrite(output1, LOW); LedState[1] = 0; } else { digitalWrite(output1, HIGH); LedState[1] = 1;} break;

case code2: if(LedState[2] == 1) { digitalWrite(output2, LOW); LedState[2] = 0; } else { digitalWrite(output2, HIGH); LedState[2] = 1;} break;

case code3: if(LedState[3] == 1) { digitalWrite(output3, LOW); LedState[3] = 0; } else { digitalWrite(output3, HIGH); LedState[3] = 1;} break;

case code4: if(LedState[4] == 1) { digitalWrite(output4, LOW); LedState[4] = 0; } else { digitalWrite(output4, HIGH); LedState[4] = 1;} break;

}

Serial.println(value); // you can comment this line

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

}

Step 2: Download This

Add Include Library Top Of Line Code

Step 3: More Simple Way U Can Do It

#include

#include

int Led1=9;int Led2=10;int Led3=11;

int Led1State=0;int Led2State=0;int Led3State=0;

int ReceptorIR =3;

IRrecv irrecv(ReceptorIR);

decode_results decodeValue;

void setup() {

Serial.begin(9600);

irrecv.enableIRIn();

pinMode(Led1,OUTPUT);pinMode(Led2,OUTPUT);pinMode(Led3,OUTPUT);

}

void loop()

{ if (irrecv.decode(&decodeValue))

{ switch (decodeValue.value)

{

case 0x202807F:Led1State = ~Led1State; digitalWrite(Led1, Led1State);

break;

case 0x20240BF:Led2State = ~Led2State; digitalWrite(Led2,Led2State);

break;

case 0x202C03F:Led3State = ~Led3State; digitalWrite(Led3,Led3State);

break;

}

Serial.println(decodeValue.value, HEX);irrecv.resume();

}

}

About This Instructable

214views

6favorites

License:

Bio: www.facebook.com/edtmamun
More by MamunEdt:How to IR Tv Remote Control Led or Relay With Arduino  How to Control 4 Led or Relay With 4 Buttons With Arduino  How to Blutooth RGB LED Light With Android App 
Add instructable to: