Problem whit Photoresistor

Hi folks! I'm trying to make a solar tracker as project for high school, the sketch works fine but the problem are the photoresitors that every time give me back the max value (1023).. I shall put my finger on the photoresitor to recive a lower input and moving the servo.
How I can fix this? Thanks!

It sounds like the fixed resistor between the input pin and ground is not connected.

If you connect an input pin to +5 through a resistor, even a Light Dependent Resistor, it will read 1023 all the time. To get a range of value you also need a resistor going to Ground for the LDR to fight against. Pick a resistor about half-way between the dark resistance of the LDR and the resistance in sunlight. That will put that mid-brightness point around 512 on the analog input. Brighter lights will get you a higher reading and lower lights will get a lower reading.

You are right! :smiley:
Thank you so much!