I cant marry the IR code with the switch code. Please help me.

Good afternoon
I want to control 1 Led, using IR remote control (with sensor) and 1 switch .
My problem is that I do not know how I can marry the IR code with the switch code.

I made this code :

#include <IRremote.h>
#define Button_1 0x40BF00FF // Πανω
#define Button_5 0x40BFF807 // STOP

const int BUTTON = 6;
int BUTTONstate = 0;

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
const int redPin = 10;
const int greenPin = 11;

void setup() {
irrecv.enableIRIn();
irrecv.blink13(true);
pinMode(BUTTON, INPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);

}

void loop()
{
if (irrecv.decode(&results))
{
switch(results.value)
{
case 0x40BF00FF: // Πανω
digitalWrite(redPin, HIGH);
break;

case 0x40BFF807: //STOP
digitalWrite(redPin, LOW);
break;
}

irrecv.resume();
}

}

red_tie_projects:
Good afternoon
I want to control 1 Led, using IR remote control (with sensor) and 1 switch .
My problem is that I do not know how I can marry the IR code with the switch code.

First, when posting code please use code tags. Second, what does "I want to control 1 Led, using IR remote control (with sensor) and 1 switch". Does the switch and the IR have to be active at the same time to light the LED? Or should the LED light if either one is active? Should the LED stay lit after it is turned on, immediately turn off, or stay on for a certain amount of time?

Please be specific as to what you want to happen.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.