can somebody give me a little help!?

Hi,
I having a problem with my sketch. It was work fine before and all of a sudden when i changed a board from mega to uno its not read my LDR, the LDR is fine i tested.
The serial monitor showing a following:
"
Starting
LDR Level: 0Threshold:330
Light Active
Top PIR Triggered

"

and thats it :frowning:
Please note, Not i write the sketch.

THANK YOU FOR READING

//======================================================================================================//
// = Libraries required =//
//======================================================================================================//

#include <Bounce2.h>

//======================================================================================================//
// = Pin Allocations =//
//======================================================================================================//
#define Step1LEDPin 2 // the LEDs are connected to sequentional pins starting at this pin
#define Step2LEDPin 3 // the LEDs are connected to sequentional pins starting at this pin
#define Step3LEDPin 4 // the LEDs are connected to sequentional pins starting at this pin
#define Step4LEDPin 5 // the LEDs are connected to sequentional pins starting at this pin
#define Step5LEDPin 6 // the LEDs are connected to sequentional pins starting at this pin
// the LEDs are connected to sequentional pins starting at this pin

#define PIRTop A1
#define PIRBottom A0

#define LDR A3

//======================================================================================================//
// = Contsants =//
//======================================================================================================//
#define LightThresholdLevel 330
#define LEDStepTime 400 // miliseconds
#define LEDOnTime 7000 // miliseconds
#define filterSamples 25

//======================================================================================================//
// = Global Variables =//
//======================================================================================================//
uint8_t SequenceLoop = 0;
int RawADC = 0;
int LightLevel = 0;

//======================================================================================================//
// = Low Pass Filter Variables =//
//======================================================================================================//
int DS_J_Loop;
int DS_K_Loop;
int DS_Temp;
int DS_Top;
int DS_Bottom;
long DS_Total;
int DS_ArrayPointer;
int DS_FilterArray[filterSamples];
boolean DS_SortDone = false;

//======================================================================================================//
// = PIR State Structure =//
//======================================================================================================//
struct PIRState
{
bool Change;
bool State;
bool LastState;
} State_PIR_Top,State_PIR_Bottom;

//======================================================================================================//
// = PIR input Definitions =//
//======================================================================================================//
Bounce B_PIR_TOP = Bounce();
Bounce B_PIR_Bottom = Bounce();
//======================================================================================================//
// Timer ISR Handler //
//======================================================================================================//

//======================================================================================================//
// = Set Everything up //
//======================================================================================================//
void setup()
{

Serial.begin(9600);

Serial.println(“Starting”);

pinMode(Step1LEDPin, OUTPUT);
pinMode(Step2LEDPin, OUTPUT);
pinMode(Step3LEDPin, OUTPUT);
pinMode(Step4LEDPin, OUTPUT);
pinMode(Step5LEDPin, OUTPUT);

pinMode(PIRTop, INPUT_PULLUP);
pinMode(PIRBottom, INPUT_PULLUP);

B_PIR_TOP.attach(PIRTop);
B_PIR_Bottom.attach(PIRBottom);

Allon();
delay(7000);
Alloff();
}

//======================================================================================================//
//= Run The Loop //
//======================================================================================================//
void loop()
{
RawADC = analogRead(LDR);
LightLevel = digitalSmooth(RawADC, DS_FilterArray);

Serial.print("LDR Level : ");
Serial.print(LightLevel);
Serial.print("Threshold : ");
Serial.println(LightThresholdLevel);

B_PIR_TOP.update();
B_PIR_Bottom.update();

if (LightLevel <= LightThresholdLevel)
{
Serial.println(“Light Active”);

if (B_PIR_TOP.read())
{
Serial.println(“Top PIR Triggered”);
digitalWrite(Step1LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step2LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step3LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step4LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step5LEDPin, LOW);
delay(LEDStepTime);

delay(LEDOnTime);

B_PIR_TOP.update();
while (B_PIR_TOP.read())
{
B_PIR_TOP.update();
}

delay(LEDStepTime);
digitalWrite(Step1LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step2LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step3LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step4LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step5LEDPin, HIGH);
delay(LEDStepTime);

Alloff();

}
else if (B_PIR_Bottom.read())
{
Serial.println(“Bottom PIR Triggered”);

digitalWrite(Step5LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step4LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step3LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step2LEDPin, LOW);
delay(LEDStepTime);
digitalWrite(Step1LEDPin, LOW);

delay(LEDOnTime);

B_PIR_Bottom.update();
while (B_PIR_Bottom.read())
{
B_PIR_Bottom.update();
}

digitalWrite(Step5LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step4LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step3LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step2LEDPin, HIGH);
delay(LEDStepTime);
digitalWrite(Step1LEDPin, HIGH);
delay(LEDStepTime);

Alloff();
}

}

}

//======================================================================================================//
// Turn All LEDs off //
//======================================================================================================//
void Alloff()
{
digitalWrite(Step1LEDPin, HIGH);
digitalWrite(Step2LEDPin, HIGH);
digitalWrite(Step3LEDPin, HIGH);
digitalWrite(Step4LEDPin, HIGH);
digitalWrite(Step5LEDPin, HIGH);

}

void Allon()
{

digitalWrite(Step5LEDPin, LOW);
digitalWrite(Step4LEDPin, LOW);
digitalWrite(Step3LEDPin, LOW);
digitalWrite(Step2LEDPin, LOW);
digitalWrite(Step1LEDPin, LOW);
}

//======================================================================================================//
// ADC Lowpass Filter //
//======================================================================================================//
int digitalSmooth(int rawIn, int *sensSmoothArray)
{

DS_ArrayPointer = (DS_ArrayPointer + 1) % filterSamples;

sensSmoothArray[DS_ArrayPointer] = rawIn;

for (DS_J_Loop = 0; DS_J_Loop<filterSamples; DS_J_Loop++)
{
DS_FilterArray[DS_J_Loop] = sensSmoothArray[DS_J_Loop];
}

DS_SortDone = false;

while (!DS_SortDone)
{
DS_SortDone = true;
for (DS_J_Loop = 0; DS_J_Loop < (filterSamples - 1); DS_J_Loop++)
{
if (DS_FilterArray[DS_J_Loop] > DS_FilterArray[DS_J_Loop + 1])
{
DS_Temp = DS_FilterArray[DS_J_Loop + 1];
DS_FilterArray[DS_J_Loop + 1] = DS_FilterArray[DS_J_Loop];
DS_FilterArray[DS_J_Loop] = DS_Temp;
DS_SortDone = false;
}
}
}

DS_Bottom = max(((filterSamples * 15) / 100), 1);
DS_Top = min((((filterSamples * 85) / 100) + 1), (filterSamples - 1));
DS_K_Loop = 0;
DS_Total = 0;
for (DS_J_Loop = DS_Bottom; DS_J_Loop< DS_Top; DS_J_Loop++)
{
DS_Total += DS_FilterArray[DS_J_Loop];
DS_K_Loop++;
}

return DS_Total / DS_K_Loop;
}

If you have read this before posting a programming question you have obviously decided to take no notice of it.

For all our sakes, please put your code in code tags.

How much memory does the program use ?

No, i havent read it, but i will... Sorry for inconvenience.

The program use 4,002 bytes (12%)

Zolehhun: No, i havent read it, but i will... Sorry for inconvenience.

The program use 4,002 bytes (12%)

There are three kinds of memory on an Arduino. Telling us how much of one kind, without bothering to say what kind, was a waste of time and effort.