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();
}
}