Error whle reading the current from LDR

int LDR = 0;
int LDRValue = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
LDRValue = analogRead(LDR);
Serial.println(LDRValue);
delay(50);
}
ERROR:
As soon as i connecting it to ground value is coming as zero.
This wasn't happening before.

What wasn't happening before what?
What does "ERROR:" mean? Where does it come from?
What do you expect a grounded analogue input pin to read?
Please use code tags.

LDR is ligh dependent resistor so how arduino can measure it's resistace when you are connecting it to ground only ?? You have to make a voltage divider with LDR in one branch : LMGTFY - Let Me Google That For You .

BTW : use code tags  [code] [ /code]  to post your code ![/code]


whats wrong with this setup

whats wrong with this setup

I can't read the resistor value and I can't read the LDR part number.

And he's silly using a 9v PP3 battery.

Mark

First things first. AnalaoRead() measures voltage, not current.

If the Arduino is getting enough current from the 9v battery what you have in the picture should work. Those PP3 batteries are not really suitable. Why not power it using the USB connection - I presume the LDR and resistor won't allow much current tp flow.

You haven't shown what you mean when say "connecting it to ground". With the setup in your picture if you connect either end of the LDR to ground the Arduino will read 0 volts. Of course DON'T connect the Arduino 5v to ground.

50 millisecs is a very short delay for something you want to display on screen. Start with 2000 msecs.

...R

AWOL:
I can’t read the resistor value and I can’t read the LDR part number.

Looks very much like a 10k resistor to me.

I could be a bit vague here, but I have never seen a part number on a LDR.
{Looks in drawer possibly for first time in 20 years}
I have a couple - one blue and one orange encapsulation, one of which must be an “ORP12”; the blue one has “HOLLAND” over “91” and the orange one has a 6 (or 9) and a triangle. The others with the plain white substrate - like the one pictured but bigger - have no markings at all.

The orange “ORP12” has badly degraded inside.

Word on the 'net is that these things are not reliable in the long term.

If you have a voltmeter, what do you measure across the 10K resistor at different light levels?