Smart House IR Remote Controlled Home Automation Us Ing: Arduino
Smart House IR Remote Controlled Home Automation Us Ing: Arduino
Smart House IR Remote Controlled Home Automation Us Ing: Arduino
int first_led_pin = 7;
int second_led_pin = 6;
int third_led_pin = 5;
int fourth_led_pin = 4;
IRrecv receiver(receiver_pin);
decode_results output;
void setup()
{
Serial.begin(9600);
receiver.enableIRIn();
pinMode(first_led_pin, OUTPUT);
pinMode(second_led_pin, OUTPUT);
pinMode(third_led_pin, OUTPUT);
pinMode(fourth_led_pin, OUTPUT);
}
void loop() {
if (receiver.decode(&output)) {
unsigned long int value = output.value;
if(value == 16460501)
{
if(led[1] == 1)
{
digitalWrite(first_led_pin, LOW);
led[1] = 0;
} else {
digitalWrite(first_led_pin, HIGH);
led[1] = 1;
}
}
else if(value == 16476311)
{
if(led[2] == 1)
{
digitalWrite(second_led_pin, LOW);
led[2] = 0;
}
else {
digitalWrite(second_led_pin, HIGH);
led[2] = 1;
}
}
else if(value == 16492631)
{
if(led[3] == 1)
{
digitalWrite(third_led_pin, LOW);
led[3] = 0;
} else {
digitalWrite(third_led_pin, HIGH);
led[3] = 1;
}
}
if(value == 16452341)
{
if(led[4] == 1)
{
digitalWrite(fourth_led_pin, LOW);
led[4] = 0;
} else {
digitalWrite(fourth_led_pin, HIGH);
led[4] = 1;
}
}
Serial.println(value);
receiver.resume();
}
}
//
• PROJECT AND CERCUIT SIMULATION