increment counter just giving 000000000

#define LDRT A0 //top LDR
#define LDRB A3//bottom LDRs
#define LDRB2 A5 //bottom LDRs
#define Buz1 11
#define Red 9
#define Blue 8
#define Yel 10

int x = 200 ;
int val1;
int val2;
int val3;
int timer=0;

void setup() {
int val1 = 0;
int val2 = 0;
int val3 = 0;

pinMode(LDRT, INPUT);
pinMode(LDRB, INPUT);
pinMode(LDRB2, INPUT);
pinMode(Buz1, OUTPUT);
pinMode(Red, OUTPUT);
pinMode(Blue, OUTPUT);
pinMode(Yel, OUTPUT);
Serial.begin(9600);
Serial.setTimeout(50);
}

void loop() {
val1= analogRead(LDRT); //Analog reading all 3 LDRs
val2= analogRead(LDRB);
val3= analogRead(LDRB2);
if(val2&&val3<200) // if bottom two LDRs are covered, then read top LDR.
{
if (val1>200)
{digitalWrite(Red, HIGH);
delay(500);
digitalWrite(Red, LOW);
delay(500);
}

}
delay(50);
count();
delay(50);

}

void count (void){

if (val2&&val3<200){
delay(1000);
timer++;
delay(50);}
if (timer>=3){
digitalWrite(Yel, HIGH);
delay(500);
digitalWrite(Yel, LOW);
delay(500);

}
if (val2||val3>200){
timer=0;}
delay(50);
Serial.println(timer);
delay(50);

}

Please post the full code inside code tag

if u[/u]{

Have you done a Serial.print on the highlighted expression to see its actual value?

You SHOULD NOT use delay() function when you count the button press.

When counting the press from button, there are two uses you should to cares:

  • do not use delay() function. If you use, you will miss some the press event
  • consider to chattering phenomenon. If not, you will count wrong.

If you implement code, take a look to this post Button FAQ: common mistake - button does NOT work as expected. - Introductory Tutorials - Arduino Forum

If you want to be easy, I recommend using this library. This library takes care all of the above issues for you.