HOOK STAR
Published © MIT

IR Remote To ON OFF Home Appliance

You can apply this to your home!

AdvancedFull instructions provided9 minutes772
IR Remote To ON OFF Home Appliance

Things used in this project

Hardware components

IR receiver (generic)
×1
Adafruit IR Remote
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

CUIRCIT DIAGRAM

Code

IR ON OFF LED CODE

C/C++
#include <IRremote.h>
 
int RECV_PIN = 3; // the pin where you connect the output pin of TSOP4838
int led1 = 2;
int itsONled[] = {0};
/* the initial state of LEDs is OFF (zero) 
the first zero must remain zero but you can 
change the others to 1's if you want a certain
led to light when the board is powered */ // code received from button 1
 
 
decode_results results;
 
void setup()
{
  Serial.begin(9600);   // you can comment this line
  irrecv.enableIRIn();  // Start the receiver
  pinMode(led1, OUTPUT);
}
 
void loop() {
  if (irrecv.decode(&results)) {
    unsigned int value = results.value;
    {
         if(itsONled[1] == 1) {        // if first led is on then
            digitalWrite(led1, LOW);   // turn it off when button is pressed
            itsONled[1] = 0;           // and set its state as off
         } else {                      // else if first led is off
             digitalWrite(led1, HIGH); // turn it on when the button is pressed
             itsONled[1] = 1;          // and set its state as on
         }
          break; 
    }
    Serial.println(value); // you can comment this line
    irrecv.resume(); // Receive the next value
  }
}

Credits

HOOK STAR

HOOK STAR

1 project • 8 followers
i'm IoT Developer In Surat,Gujarat-395008

Comments