Skip to main content
deleted 25 characters in body
Source Link
Greenonline
  • 3.2k
  • 7
  • 37
  • 49

Hello I would like to use the IR remote with arduioArduino to turn on a LED and turn off the same LED when I push on the remote.

That is to say :

If I push on 1 I would like the LED turn on If I push on 2 I would like the LED turn off

  • If I push on 1 I would like the LED turn on
  • If I push on 2 I would like the LED turn off

Here is my code :

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

const int L1 = 13;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(L1, OUTPUT);
}

void loop(){
  if (irrecv.decode(&results)){
        unsigned int value = results.value;
        Serial.println(value);
        irrecv.resume();
        if(value == 12495){
        digitalWrite(L1, HIGH);
        delay(1000);
        } 
        else if(value == 6375){
        digitalWrite(L1, LOW);
        delay(1000);  
      }
        
  }
}

But the problem is when I push on 1 I just see the LED turn on but very quickly the LED turns off then whereas I don't push on the button 2.

Could you help me please  ?

Thank you very much !

Hello I would like to use the IR remote with arduio to turn on a LED and turn off the same LED when I push on the remote.

That is to say :

If I push on 1 I would like the LED turn on If I push on 2 I would like the LED turn off

Here is my code :

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

const int L1 = 13;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(L1, OUTPUT);
}

void loop(){
  if (irrecv.decode(&results)){
        unsigned int value = results.value;
        Serial.println(value);
        irrecv.resume();
        if(value == 12495){
        digitalWrite(L1, HIGH);
        delay(1000);
        } 
        else if(value == 6375){
        digitalWrite(L1, LOW);
        delay(1000);  
      }
        
  }
}

But the problem is when I push on 1 I just see the LED turn on but very quickly the LED turns off then whereas I don't push on the button 2.

Could you help me please  ?

Thank you very much !

I would like to use the IR remote with Arduino to turn on a LED and turn off the same LED when I push on the remote.

That is to say :

  • If I push on 1 I would like the LED turn on
  • If I push on 2 I would like the LED turn off

Here is my code :

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

const int L1 = 13;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(L1, OUTPUT);
}

void loop(){
  if (irrecv.decode(&results)){
        unsigned int value = results.value;
        Serial.println(value);
        irrecv.resume();
        if(value == 12495){
        digitalWrite(L1, HIGH);
        delay(1000);
        } 
        else if(value == 6375){
        digitalWrite(L1, LOW);
        delay(1000);  
      }
        
  }
}

But the problem is when I push on 1 I just see the LED turn on but very quickly the LED turns off then whereas I don't push on the button 2.

Could you help me please?

Source Link

Use IR remote with arduino

Hello I would like to use the IR remote with arduio to turn on a LED and turn off the same LED when I push on the remote.

That is to say :

If I push on 1 I would like the LED turn on If I push on 2 I would like the LED turn off

Here is my code :

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

const int L1 = 13;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
  pinMode(L1, OUTPUT);
}

void loop(){
  if (irrecv.decode(&results)){
        unsigned int value = results.value;
        Serial.println(value);
        irrecv.resume();
        if(value == 12495){
        digitalWrite(L1, HIGH);
        delay(1000);
        } 
        else if(value == 6375){
        digitalWrite(L1, LOW);
        delay(1000);  
      }
        
  }
}

But the problem is when I push on 1 I just see the LED turn on but very quickly the LED turns off then whereas I don't push on the button 2.

Could you help me please ?

Thank you very much !