ir led and photodiode problem

I am Farhan.I am new in arduino .Recently I have planned to make a line following robot car.But I faced various problems.Most of the problems I already solved.But when I came to to the part of IR led and photodiode .I tried to find a code and a sketch .I got one,but it wasn't working.Here is that code:

int pd=2;                      //Photodiode to digital pin 2
 int buzz=13;                   //piezo buzzer to digital pin 13  
 int senRead=0;                 //Readings from sensor to analog pin 0  
 int limit=850;                 //Threshold range of an obstacle  
 void setup()    
 {  
  pinMode(pd,OUTPUT);  
  pinMode(buzz,OUTPUT);  
  digitalWrite(pd,HIGH);       //supply 5 volts to photodiode  
  digitalWrite(buzz,LOW);      //set the buzzer in off mode (initial condition)  
  Serial.begin(9600);          //setting serial monitor at a default baund rate of 9600  
 }  
 void loop()  
 {  
  int val=analogRead(senRead);  //variable to store values from the photodiode  
  Serial.println(val);          // prints the values from the sensor in serial monitor  
  if(val <= limit)              //If obstacle is nearer than the Threshold range  
  {  
   digitalWrite(buzz,HIGH);     // Buzzer will be in ON state  
   delay(20);  
  }  
  else if(val > limit)          //If obstacle is not in Threshold range  
  {  
   digitalWrite(buzz,LOW);      //Buzzer will be in OFF state  
   delay(20);  
  }  
 }

And my sketch is below:

I wish someone will help me....Thanks

What values does the print statement report?
Do you need to change "limit"?

There are two ways to wire the photodiode but only one can work.

What does the code do, and what do you expect it to do?

Indeed both the photodiode and the IR LED have to be wired the correct way around to work.

My val is printed 1023 in the serial monitor .So I don't think so that 'limit' variable is a big problem. I am a starter,you are all experts.So You will enable guess the problem.

This is exactly what I expect if your photodiode is wired the wrong way around.

What is the part number of the Photo Diode ? The resistor value of 3K looks very low to me.

The value of 1023 indicates that the photodiode is wired correctly and is reverse biased. The value of 3K is way too low as suggested above. Try 100K or 1 Meg.

Point the IR LED directly at the photodiode to check if it is wired correctly, or use your multimeter to measure the voltage across it (should be about 1.9 V).

Thanks
thanks a lot for your suggestion .I haven't bought 100K resistors yet;I will buy it soon.And I will try.Then I will reply again.Thanks again ....

I have a another question .Is my photodiode burned.Should I need to use another with 100K resistor?

Probably not burned.