Search in The Electromania's Blog

Monday, 23 November 2015

IR remote kit LED blink using Arduino Due


IR remote kit LED blink using Arduino Due

Original library available at- https://github.com/enternoescape/Arduino-IRremote-Due  

Led connected to pin 7 of Arduino due
IR receiver photo-detector connected to pin 11

Modified code for this project is-----

//#include "global_def.h"  // These don't seem to work.  They should.
//#include "ms_remote_map.h" // These don't seem to work.  They should.
#include <IRremote2.h>

//#define ms_remote_map.h

#define RECV_PIN 11
#define LED_PIN 7 // choose the pin for the LED

byte ledState;
IRrecv irrecv(RECV_PIN);
decode_results results;
boolean power_state = LOW;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED_PIN, OUTPUT);  // declare LED as output
  pinMode(RECV_PIN, INPUT);  // declare LED as output
}

void loop() {
  if (irrecv.decode(&results)) {  //If IR receive results are detected
     Serial.println(results.value, HEX);
   
    if (results.value == 0x143226DB)
     {
     
       digitalWrite(LED_PIN, HIGH);
       delay(1000);
       digitalWrite(LED_PIN, LOW);
     
     }

    delay(200);  // 1/5 second delay for arbitrary clicks.
    irrecv.resume(); // Receive the next value
  }
}

No comments:

Post a Comment

Contact me for more information...

Contact Electromania

Name

Email *

Message *