Now that our code is ready, let's build our project. We use the circuit diagram as shown in the following screenshot:
Once you have hooked up your circuit according to this diagram, it is time to take your automated lamp for a spin!
If you have set your threshold values right, you will find the LED to be OFF when there is ambient light present. Lower your threshold value in case the LED still remains on.
When your room goes dark, the LDR senses this change in ambient light levels and automatically turns your LED ON!