#include <IRremote.h>
#include <Servo.h>
#define Boton_0 0xE916FF00
#define Boton_1 0xF30CFF00
#define Boton_2 0xE718FF00
#define Boton_3 0xA15EFF00
#define Boton_4 0xF708FF00
#define Boton_5 0xE31CFF00
#define Boton_6 0xA55AFF00
#define Boton_7 0xBD42FF00
#define Boton_8 0xAD52FF00
#define Boton_9 0xB54AFF00
#define Boton_100 0xE619FF00
#define Boton_200 0xF20DFF00
#define Boton_OFF 0xBA45FF00
IR = 12;
int LED1 = 2;
LED2 = 3;
LED3 = 4;
LED4 = 5;
LED5 = 6;
LED6 = 7;
LED7 = 8;
LED8 = 9;
LED9 = 10;
LED10 = 11;
servoMotor;
void setup() {
Serial.begin(9600);
servoMotor.attach(13);
IrReceiver.begin(IR, DISABLE_LED_FEEDBACK);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);
pinMode(LED5, OUTPUT);
pinMode(LED6, OUTPUT);
pinMode(LED7, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(LED9, OUTPUT);
pinMode(LED10, OUTPUT);
}
void loop() {
if (IrReceiver.decode()) {
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
switch (IrReceiver.decodedIRData.decodedRawData) {
case Boton_0:
toggleLED(LED1);
break;
case Boton_1:
toggleLED(LED2);
break;
case Boton_2:
toggleLED(LED3);
break;
case Boton_3:
toggleLED(LED4);
break;
case Boton_4:
toggleLED(LED5);
break;
case Boton_5:
toggleLED(LED6);
break;
case Boton_6:
toggleLED(LED7);
break;
case Boton_7:
toggleLED(LED8);
break;
case Boton_8:
toggleLED(LED9);
break;
case Boton_9:
toggleLED(LED10);
break;
case Boton_100:
servoMotor.write(0);
break;
case Boton_200:
servoMotor.write(90);
break;
case Boton_OFF:
break;
default:
break;
}
IrReceiver.resume();
}
}
void toggleLED(int pin) {
digitalWrite(pin, !digitalRead(pin));
}
void todooff() {
for (int pin2 = 2; pin2 <= 11; pin2++) {
digitalWrite(pin2, LOW);
}
}