using ir remote control leds in tamil

codings for control leds using tsop1738


#include <IRremote.h>

int RECV_PIN = 4; //

int output1 = 8;

int output2 = 9;

int output3 = 10;

int output4 = 11;

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

#define code1  0xE0E020DF //

#define code2  0xE0E0A05F //

#define code3  0xE0E0609F //

#define code4  0xE0E010EF

#define power  0xE0E040BF

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(itsONled[1] == 1) {     

           digitalWrite(output1, LOW);

           itsONled[1] = 0;         

        } else {                     

            digitalWrite(output1, HIGH);

            itsONled[1] = 1;         

        }

         break;

      case code2:

        if(itsONled[2] == 1) {

           digitalWrite(output2, LOW);

           itsONled[2] = 0;

        } else {

            digitalWrite(output2, HIGH);

            itsONled[2] = 1;

        }

         break;

      case code3:

        if(itsONled[3] == 1) {

           digitalWrite(output3, LOW);

           itsONled[3] = 0;

        } else {

            digitalWrite(output3, HIGH);

            itsONled[3] = 1;

        }

         break;

     case code4:

        if(itsONled[4] == 1) {

           digitalWrite(output4, LOW);

           itsONled[4] = 0;

        } else {

            digitalWrite(output4, HIGH);

            itsONled[4] = 1;

        }

         break;

     case power:

        if(itsONled[0] == 1) {

           digitalWrite(output1, LOW);

           digitalWrite(output2, LOW);

           digitalWrite(output3, LOW);

           digitalWrite(output4, LOW);

           itsONled[0] = 0;

        } else {

          digitalWrite(output1, HIGH);

          digitalWrite(output2, HIGH);

          digitalWrite(output3, HIGH);

          digitalWrite(output4, HIGH);

          itsONled[0] = 1;

        }

         break;   

   }

   Serial.println(value);

   irrecv.resume();

 }

}

***************-------------------*******************----------------------*******************

copy the code and must change the HEX code....

put that your remote HEX code..

and the upload that...

Comments

Popular posts from this blog

CHATBOT programming tutorial in tamil

programing part for petrol level measuring in tamil

using millis() in ultrasonic sensor program in tamil