#include <IRremote.h>
#include <Servo.h>
#include <FastLED.h>
CRGB leds[0];
int pin_receiver = 2;
int button_value = 0;
int bright = 20;
Servo myservo1;
IRrecv receiver(pin_receiver);
void setup()
{
receiver.enableIRIn();
myservo1.attach(10);
Serial.begin(9600);
}
void loop()
{
if (receiver.decode())
{
translateIR();
receiver.resume();
}
}
void translateIR()
{
button_value = receiver.decodedIRData.command;
if (button_value == 226) {
Serial.println("Forward - Driver door opens, Backward Driver Door close, 1 - Li,");
}
if(button_value == 224) {
myservo1.write(0);
Serial.println("Door closed.");
}
if (button_value == 144) {
myservo1.write(180);
Serial.println("Door open.");
}
if (button_value == 48) {
leds[1] = CRGB::Red;
FastLED.show();
}
if (button_value == 24) {
leds[1] =CRGB::Green;
FastLED.show();
}
if (button_value == 122) {
leds[1] = CRGB::Blue;
FastLED.show();
}
if (button_value == 16) {
for(int i = 0; i < 20; i++)
{
leds[1] =CRGB(0, 225, 221);
FastLED.show();
delay(50);
leds[1] =CRGB(233, 255, 34);
FastLED.show();
delay(50);
leds[1] =CRGB(225, 0, 191);
FastLED.show();
delay(50);
}
}
if (button_value == 168) {
bright = bright + 40;
FastLED.setBrightness(bright);
FastLED.show();
}
if (button_value == 162) {
Serial.println("Application Stopped!");
myservo1.write(90);
FastLED.clear();
FastLED.show();
}
}