With a photoresistor you can acquire the amount of light in your ambient.
You could use this value for several different purposes, for example you can turn on the lights when the sun sets at evening or you can turn them off when the sun rises at morning.
This simple sketch show how to retrieve this value
BOM (Bill of material)
1 10kohm resistor
Connect the photoresistor and the resistor to your arduino board as follows:
Connect your arduino board to your PC and burn the following sketch:
connect to the Arduino board through the Serial Monitor on the Arduino IDE, on the serial line you should see something like the following few lines:
At first my photoresistor was covered with a cartoon box 😉 then I removed the box and immediately the value rised. You can try moving the box slowly and you’ll see a slow variation in the values printed on the serial line.