Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
×1
IR receiver (generic)
×1
09590 01
LED (generic)
×2
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
Relay (generic)
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

schematics
schematics
myirproject_QKx19zmXkH.fzz

Code

upload this code to arduinoArduino
CODE
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>

int receiver = 2; // Signal Pin of IR receiver to Arduino Digital Pin 11
bool hit = false;

/*-----( Declare objects )-----*/
IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  Serial.begin(9600);
  Serial.println("IR Receiver Button Decode"); 
  irrecv.enableIRIn(); // Start the receiver
  pinMode(8,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(9,OUTPUT);

}/*--(end setup )---*/


void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  if (irrecv.decode(&results)) // have we received an IR signal?

  {
    translateIR(); 
    irrecv.resume(); // receive the next value
  }  
}/* --(end main loop )-- */

/*-----( Function )-----*/
void translateIR() // takes action based on IR code received

// describing Remote IR codes 

{

  if (results.value==0x14EB18E7){ // use the code you got in IRrecvdemo sketch here
     hit = !hit;
  }
  if (hit==true) {
    digitalWrite(10,LOW);
    digitalWrite(8,HIGH);
    digitalWrite(9,HIGH);
  }
  else {
    digitalWrite(9,LOW);
    digitalWrite(8,LOW);
    digitalWrite(10,HIGH);
  }

  delay(100); // Do not get immediate repeat


} 

Credits

Img 20171101 231933 oiqs2szwyk
muhammed shameel k.v
0 projects • 3 followers
I am a great at electronics. I have programming knowledge and some projects of my own
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog