AnalogRead on Mega not responding

If you are still having problems:

  1. try reversing the black and red wires as shown in your OP to see if the analog read now yields a value of 0 instead of the 1023. If so, suspect that the resistor has an open circuit.

  2. replace the ldr with a resistor of the same value as the existing resistor (10K ? ) and see if the analog reading is now about 512.

  3. disconnect the red, black and yellow wires from the arduino and measure the resistance between the red and the black wires. The value of the resistance should change according to the ambient light.