circuit to convert analog to digital..

how can i make a circuit to give a LDR's output as a simple logic 1 and 0??

adilmalik:
how can i make a circuit to give a LDR's output as a simple logic 1 and 0??

Using an Arduino or a standalone electronic circuit?

Lefty

Use an LM399 quad voltage comparator. One terminal you connect to a pot and that will set the threshold, the other you connect to your LDR signal. The output will be high or low depending on the voltage level.

So ive made the cirucit using the dual comparator lm393...because its output is negative ive also used a pnp transistor to feed its output to the input of the arduino. But the problem is when i cover the LDR the state is high and the serial monitor reads high,but when i remove my hand from the LDR the serial monitor goes haywire,continuously goes on,off,on,off...(ive also put a led on by circuits output and it turns off when i circuit is LOW.IS THE ARDUINO A BIT TO ACCURATE?

because its output is negative ive also used a pnp transistor to feed its output to the input of the arduino.

???? - you need to include a schematic. There should be no need for this.

but when i remove my hand from the LDR the serial monitor goes haywire,

You need to enable the internal pull up resistors or put an external one on the arduino's input.
Or if you have a transistor in the way put a pull up on the output of your comparator.

Connect it to an analog input and then decide in sw what's the transition point between 0 and 1:

if (analogRead(...) > X) LDR = 1
else LDR = 0

LAYADA has a nice little tutorial on this.

http://www.ladyada.net/learn/sensors/cds.html