adding two programs

// A

[
int yellowPin = PB14;

int analogPin = PA6;

void setup()
{

pinMode(yellowPin, OUTPUT);

}
void loop()
{
int val = analogRead(analogPin);
int mapVal = map(val, 2000, 2500, 0, 3);
switch(mapVal)
{
case 0:
setLights(LOW, LOW, HIGH);
break;
case 1: setLights(LOW, HIGH, LOW);
break;
case 2: setLights(HIGH, LOW, LOW);
break;
}
}

void setLights(int red, int yellow, int green)
{

digitalWrite(yellowPin, yellow);

} ]

B

[
// Moving Average Example
// Shows how to use an FIR filter as a moving average on a simple
// set of data that can be easily verified by hand.

#include <FIR.h> // you may need to install FIR Filter Arduino Library
to have it

// Make an instance of the FIR filter. In this example we’ll use
// floating point values and an 8 element filter. For a moving average
// that means an 8 point moving average.
FIR<float, 8> fir;

void setup() {
Serial.begin(115200); // Start a serial port

// For a moving average we want all of the coefficients to be unity.
float coef[8] = { 1., 1., 1., 1., 1., 1., 1., 1.};

// Set the coefficients
fir.setFilterCoeffs(coef);

Serial.print("Gain set: ");
Serial.println(fir.getGain());
}

void loop() {
// Calculate the moving average for a time series with the elements.
// 0, 1, 2, …, 13, 14, 15
for (float i=0; i < 16; i++) {
Serial.println(fir.processReading(i));
}

while (true) {}; // Spin forever
}

// LED pulses program

int yellowPin = PB14; // pulses otput

int analogPin = PA6; // signal input

void setup()
{

pinMode(yellowPin, OUTPUT);

}
void loop()
{
int val = analogRead(analogPin);
int mapVal = map(val, 2300, 2500, 0, 3);
switch(mapVal)
{
case 0:
setLights(LOW, LOW, HIGH);
break;
case 1: setLights(LOW, HIGH, LOW);
break;
case 2: setLights(HIGH, LOW, LOW);
break;
}
}

void setLights(int red, int yellow, int green)
{

digitalWrite(yellowPin, yellow);

}
]

Please use code tags (</> button on the toolbar) when you post code or warning/error messages. The reason is that the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier to read your code and to copy it to the IDE or editor. If your browser doesn’t show the posting toolbar then you can just manually add the code tags:
[code]``[color=blue]// your code is here[/color]``[/code]
Using code tags and other important information is explained in the How to use this forum post. Please read it.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor you will not have access to this useful tool but it’s still unacceptable to post poorly formatted code. I recommend you to use the standard IDE instead.

Please remove unnecessary blank lines from your code before posting to the forum. One or two to separate code into logical sections is fine but large spaces for no reason or random blank lines just make for more scrolling when we’re trying to read your code. Do not post double spaced code.

There’s tons of information available on this topic. Just search for merge sketches or combine sketches.

can someone help me to combine this two programs, filter first and LED program second - filtering the signal before is pass to LED program ?

Do some research, then give it a try. If you run into problems then come back here and post your attempt (correctly this time) and we'll help you out.