Devices & Components
Arduino Uno Rev3
Infrared (IR) Proximity / Obstacle Detecting Sensor Module
Project description
Code
Arduino Switch light on off
arduino
Use this code to switch on off the light remember to replace remote button code.
1/*Light on off code*/ 2#include <boarddefs.h> 3#include <ir_Lego_PF_BitStreamEncoder.h> 4#include <IRremote.h> 5#include <IRremoteInt.h> 6int RECV_PIN = 9; 7int OUT_PIN=8; 8IRrecv irrecv(RECV_PIN); 9decode_results results; 10void setup() 11{ 12 pinMode(OUT_PIN,OUTPUT); 13 Serial.begin(9600); 14 irrecv.enableIRIn(); // Start the receiver 15} 16void loop() 17{ 18 if (irrecv.decode(&results)) 19 { 20 Serial.println(results.value); 21 if(results.value == 490607474){ //Please replace your remote button code for which you want to on the light 22 digitalWrite(OUT_PIN,HIGH); 23 delay(1000); 24 }else{ 25 digitalWrite(OUT_PIN,LOW); 26 } 27 delay(1000); 28 irrecv.resume(); // Receive the next value 29 } 30 31 delay(000); 32}
Arduino Switch light on off
arduino
Use this code to switch on off the light remember to replace remote button code.
1/*Light on off code*/ 2#include <boarddefs.h> 3#include <ir_Lego_PF_BitStreamEncoder.h> 4#include <IRremote.h> 5#include <IRremoteInt.h> 6int RECV_PIN = 9; 7int OUT_PIN=8; 8IRrecv irrecv(RECV_PIN); 9decode_results results; 10void setup() 11{ 12 pinMode(OUT_PIN,OUTPUT); 13 Serial.begin(9600); 14 irrecv.enableIRIn(); // Start the receiver 15} 16void loop() 17{ 18 if (irrecv.decode(&results)) 19 { 20 Serial.println(results.value); 21 if(results.value == 490607474){ //Please replace your remote button code for which you want to on the light 22 digitalWrite(OUT_PIN,HIGH); 23 delay(1000); 24 }else{ 25 digitalWrite(OUT_PIN,LOW); 26 } 27 delay(1000); 28 irrecv.resume(); // Receive the next value 29 } 30 31 delay(000); 32}
Arduino check Remote Code
arduino
Check remote codes using this code
1/*Created By: Anshul Pareek 2*usage : read IR SIGNALS AND PRINT ON SERIAL 3*/ 4#include <boarddefs.h> 5#include <ir_Lego_PF_BitStreamEncoder.h> 6#include <IRremote.h> 7#include <IRremoteInt.h> 8int RECV_PIN = 9; 9IRrecv irrecv(RECV_PIN); 10decode_results results; 11void setup() 12{ 13 14 Serial.begin(9600); 15 irrecv.enableIRIn(); // Start the receiver 16} 17void loop() 18{ 19 if (irrecv.decode(&results)) 20 { 21 22 Serial.println(results.value); 23 24 irrecv.resume(); // Receive the next value 25 } 26 delay(000); 27}
Downloadable files
Full Circuit Diagram
Circuit Diagram
Full Circuit Diagram

Full Circuit Diagram
Circuit Diagram
Full Circuit Diagram

Comments
Only logged in users can leave comments