Can someone combine my coding for this Car lighting system

#include “Arduino.h”
#include <FastLED.h>

#define LED_PIN 2 //LED Strip Signal Connection
#define DRLSignal 3 //DRL Switch Signal Connection
#define LeftSignal 5 //Left Blinker Signal Connection
#define RightSignal 7 //Right Blinker Signal Connection

#define NUM_LEDS 10 //Total no of LEDs in two LED strips (eg. Use 40 here for two 20 LED strips)

#define BlinkerLEDs NUM_LEDS/5

int BlinkerSpeed = 30; //Turn Signal Running LED Speed. Adjust this to match with your vehicle turn signal speed.
int BlinkerOffDelay = 250; //Turn Signal Off time. Adjust this to match with your vehicle turn signal speed.

int StartupSpeed = 25;
int DRLDetect = 0;

int DRLColour = 1; //Change LED colour here, 1-Ice Blue, 2-Blue, 3-White, 4-Orange

CRGB leds[NUM_LEDS];
int r,r_dim,g,g_dim,b,b_dim;

void setup()
{
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
pinMode(DRLSignal, INPUT);
pinMode(LeftSignal, INPUT);
pinMode(RightSignal, INPUT);
}

void loop()
{
if(DRLDetect == 0)
{
if(digitalRead(DRLSignal)==1)
{
DRLDetect = 1;
}
}

if(DRLDetect == 2)
{
if(digitalRead(DRLSignal)==0)
{
DRLDetect = 3;
}
}

if(DRLDetect == 1)
{
DRL_ON();
DRLDetect = 2;
}

if(DRLDetect == 3)
{
DRL_OFF();
DRLDetect = 0;
}

if(digitalRead(DRLSignal)==0)
{
if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==0)) //Left Blinker
{
RightOff();
LeftBlinker();
LeftDim();
delay (BlinkerOffDelay);
}

if((digitalRead(RightSignal)==1)&&(digitalRead(LeftSignal)==0)) //Right Blinker
{
LeftOff();
RightBlinker();
RightDim();
delay (BlinkerOffDelay);
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==1)) //Dual Blinker / Hazard
{
MiddleOff();
DualBlinker();
LeftDim();
RightDim();
delay (BlinkerOffDelay);
}
}

if(DRLDetect == 2)
{
if((digitalRead(LeftSignal)==0)&&(digitalRead(RightSignal)==0)) //Park Light
{
ParkFull();
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==0)) //Left Blinker
{
LeftDim();
RightLit();
LeftBlinker();
LeftDim();
delay (BlinkerOffDelay);
}

if((digitalRead(RightSignal)==1)&&(digitalRead(LeftSignal)==0)) //Right Blinker
{
RightDim();
LeftLit();
RightBlinker();
RightDim();
delay (BlinkerOffDelay);
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==1)) //Dual Blinker / Hazard
{
LeftDim();
RightDim();
ParkMiddle();
DualBlinker();
LeftDim();
RightDim();
delay (BlinkerOffDelay);
}
}

switch (DRLColour)
{
case 1:
g = 255;
g_dim = 30;
b = 255;
b_dim = 30;
break;

case 2:
b = 255;
b_dim = 30;
break;

case 3:
r = 255;
r_dim = 30;
g = 255;
g_dim = 30;
b = 255;
b_dim = 30;
break;

case 4:
r = 255;
r_dim = 30;
g = 165;
g_dim = 20;
b = 0;
b_dim = 0;
break;
}

}

void DRL_ON()
{
for (int j = ((NUM_LEDS/2)-1); j >= 0; j–)
{
leds[j] = CRGB(r_dim, g_dim, b_dim);
leds[j+1] = CRGB(0, 0, 0);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)] = CRGB(r_dim, g_dim, b_dim);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)-1] = CRGB(0, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

for (int i = 0; i < (NUM_LEDS/2); i++)
{
leds[i] = CRGB(r_dim, g_dim, b_dim);
leds[(NUM_LEDS-1)-i] = CRGB(r_dim, g_dim, b_dim);
FastLED.show();
delay (StartupSpeed);
}

for (int j = ((NUM_LEDS/2)-1); j >= 0; j–)
{
leds[j] = CRGB(r, g, b);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)] = CRGB(r, g, b);
FastLED.show();
delay (StartupSpeed);
}
}

void DRL_OFF()
{

for (int j = 0; j <= ((NUM_LEDS/2)-1); j++)
{
leds[j] = CRGB(r, g, b);
leds[j-1] = CRGB(r_dim, g_dim, b_dim);
leds[(NUM_LEDS-1)-j] = CRGB(r, g, b);
leds[(NUM_LEDS)-j] = CRGB(r_dim, g_dim, b_dim);
FastLED.show();
delay (StartupSpeed);
}

leds[((NUM_LEDS/2)-1)] = CRGB(r_dim, g_dim, b_dim);
leds[((NUM_LEDS/2)-1)+1] = CRGB(r_dim, g_dim, b_dim);
FastLED.show();

for (int j = ((NUM_LEDS/2)-1); j >= 0; j--)

{
leds[j] = CRGB(r_dim, g_dim, b_dim);
leds[j+1] = CRGB(0, 0, 0);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)] = CRGB(r_dim, g_dim, b_dim);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)-1] = CRGB(0, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

for (int j = 0; j <= ((NUM_LEDS/2)-1); j++)
{
leds[j] = CRGB(r_dim, g_dim, b_dim);
leds[j-1] = CRGB(0, 0, 0);
leds[(NUM_LEDS-1)-j] = CRGB(r_dim, g_dim, b_dim);
leds[(NUM_LEDS)-j] = CRGB(0, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

leds[(NUM_LEDS/2)-1] = CRGB(0, 0, 0);
leds[NUM_LEDS/2] = CRGB(0, 0, 0);
FastLED.show();

}

void AllOff()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void LeftOff()
{
for (int i = 0; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void RightOff()
{
for (int i = BlinkerLEDs; i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void MiddleOff()
{
for (int i = BlinkerLEDs; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void ParkFull()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(r, g, b);
}
FastLED.show();
}

void ParkMiddle()
{
for (int i = BlinkerLEDs; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(60, 0, 0);
}
FastLED.show();
}

void LeftBlinker()
{
for (int i = (BlinkerLEDs-1); i >= 0; i–)
{
leds[i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}

void LeftDim()
{
for (int i = 0; i < BlinkerLEDs; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void LeftLit()
{
for (int i = 0; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(r, g, b);
}
FastLED.show();
}

void LeftFull()
{
for (int i = 0; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(r, g, b);
}
FastLED.show();
}

void RightBlinker()
{
for (int i = (NUM_LEDS - BlinkerLEDs); i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}

void RightDim()
{
for (int i = (NUM_LEDS - BlinkerLEDs); i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void RightLit()
{
for (int i = BlinkerLEDs; i < NUM_LEDS; i++)
{
leds[i] = CRGB(r, g, b);
}
FastLED.show();
}

void RightFull()
{
for (int i = BlinkerLEDs; i < NUM_LEDS; i++)
{
leds[i] = CRGB(r, g, b);
}
FastLED.show();
}

void DualBlinker()
{
for (int i = (BlinkerLEDs-1); i >= 0; i–)
{
leds[i] = CRGB(255, 165, 0);
leds[NUM_LEDS-1-i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}
--------->Second coding

#include “Arduino.h”
#include <FastLED.h>

#define LED_PIN 3 //LED Strip Signal Connection
#define BrakeSignal 5 //Brake Signal Connection
#define LeftSignal 7 //Left Blinker Signal Connection
#define RightSignal 9 //Right Blinker Signal Connection
#define ReverseSignal 11 //Reverse Signal Connection

#define NUM_LEDS 15 //Total no of LEDs in the LED strip
#define BlinkerLEDs 15 //No of LEDs for Left/Right Blinker

int BlinkerSpeed = 35; //Turn Signal Running LED Speed. Adjust this to match with your vehicle turn signal speed.
int BlinkerOffDelay = 250; //Turn Signal Off time. Adjust this to match with your vehicle turn signal speed.

int StartupSpeed = 25;

CRGB leds[NUM_LEDS];

void setup()
{
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
pinMode(BrakeSignal, INPUT);
pinMode(LeftSignal, INPUT);
pinMode(RightSignal, INPUT);
pinMode(ReverseSignal, INPUT);

for (int i = 0; i < (NUM_LEDS/2); i++)
{
leds[i] = CRGB(30, 0, 0);
leds[i-1] = CRGB(0, 0, 0);
leds[(NUM_LEDS-1)-i] = CRGB(30, 0, 0);
leds[(NUM_LEDS)-i] = CRGB(0, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

for (int j = ((NUM_LEDS/2)-1); j >= 0; j–)
{
leds[j] = CRGB(30, 0, 0);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)] = CRGB(30, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

for (int j = ((NUM_LEDS/2)-1); j >= 0; j–)
{
leds[j] = CRGB(255, 0, 0);
leds[(NUM_LEDS/2-1)+((NUM_LEDS/2)-j)] = CRGB(255, 0, 0);
FastLED.show();
delay (StartupSpeed);
}

for (int j = 255; j >= 60; j–)
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(j, 0, 0);
}
FastLED.show();
delay (5);
}
}

void loop()
{
if((digitalRead(ReverseSignal)==1)&&(digitalRead(BrakeSignal)==0)) //Reverse Light
{
Reverse();
}

if((digitalRead(ReverseSignal)==1)&&(digitalRead(BrakeSignal)==1)) //Brake Light
{
BrakeFull();
}

if(digitalRead(ReverseSignal)==0)
{
if((digitalRead(LeftSignal)==0)&&(digitalRead(RightSignal)==0)&&(digitalRead(BrakeSignal)==0)) //Park Light
{
ParkFull();
}

if((digitalRead(BrakeSignal)==1)&&(digitalRead(LeftSignal)==0)&&(digitalRead(RightSignal)==0)) //Brake Light
{
BrakeFull();
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==0)&&(digitalRead(BrakeSignal)==0)) //Left Blinker
{
LeftDim();
RightLit();
LeftBlinker();
LeftDim();
delay (BlinkerOffDelay);
}

if((digitalRead(RightSignal)==1)&&(digitalRead(LeftSignal)==0)&&(digitalRead(BrakeSignal)==0)) //Right Blinker
{
RightDim();
LeftLit();
RightBlinker();
RightDim();
delay (BlinkerOffDelay);
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==0)&&(digitalRead(BrakeSignal)==1)) //Left Blinker & Brake
{
LeftDim();
RightFull();
LeftBlinker();
LeftDim();
delay (BlinkerOffDelay);
}

if((digitalRead(RightSignal)==1)&&(digitalRead(LeftSignal)==0)&&(digitalRead(BrakeSignal)==1)) //Right Blinker & Brake
{
RightDim();
LeftFull();
RightBlinker();
RightDim();
delay (BlinkerOffDelay);
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==1)&&(digitalRead(BrakeSignal)==0)) //Dual Blinker / Hazard
{
LeftDim();
RightDim();
ParkMiddle();
DualBlinker();
LeftDim();
RightDim();
delay (BlinkerOffDelay);
}

if((digitalRead(LeftSignal)==1)&&(digitalRead(RightSignal)==1)&&(digitalRead(BrakeSignal)==1)) //Dual Blinker / Hazard + Brake
{
LeftDim();
RightDim();
BrakeMiddle();
DualBlinker();
LeftDim();
RightDim();
delay (BlinkerOffDelay);
}
}
}

void Reverse()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 255, 255);
}
FastLED.show();
}

void BrakeFull()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show();
}

void BrakeMiddle()
{
for (int i = BlinkerLEDs; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show();
}

void ParkFull()
{
for (int i = 0; i < NUM_LEDS; i++)
{
leds[i] = CRGB(60, 0, 0);
}
FastLED.show();
}

void ParkMiddle()
{
for (int i = BlinkerLEDs; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(60, 0, 0);
}
FastLED.show();
}

void LeftBlinker()
{
for (int i = (BlinkerLEDs-1); i >= 0; i–)
{
leds[i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}

void LeftDim()
{
for (int i = 0; i < BlinkerLEDs; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void LeftLit()
{
for (int i = 0; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(75, 0, 0);
}
FastLED.show();
}

void LeftFull()
{
for (int i = 0; i < (NUM_LEDS - BlinkerLEDs); i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show();
}

void RightBlinker()
{
for (int i = (NUM_LEDS - BlinkerLEDs); i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}

void RightDim()
{
for (int i = (NUM_LEDS - BlinkerLEDs); i < NUM_LEDS; i++)
{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
}

void RightLit()
{
for (int i = BlinkerLEDs; i < NUM_LEDS; i++)
{
leds[i] = CRGB(75, 0, 0);
}
FastLED.show();
}

void RightFull()
{
for (int i = BlinkerLEDs; i < NUM_LEDS; i++)
{
leds[i] = CRGB(255, 0, 0);
}
FastLED.show();
}

void DualBlinker()
{
for (int i = (BlinkerLEDs-1); i >= 0; i–)
{
leds[i] = CRGB(255, 165, 0);
leds[NUM_LEDS-1-i] = CRGB(255, 165, 0);
FastLED.show();
delay (BlinkerSpeed);
}
}

Hello
did you check the world wide net for a solution to combine two sketches, didn´t you?

http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

https://arduinoinfo.mywikis.net/wiki/CombiningArduinoSketches

Hi, @kyle2105
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

Tom... :smiley: :+1: :coffee: :australia: