To use a light-dependent resistor (LDR) to define the presence of light and give an audible sound based on the amount of available light.
Proteus schematic diagram
The lights sensor project needs the following parts:
Arduino
Protoboard
Piezo sounder
Light-dependent resistor
10.7 kohms resistor
Wires
Variables
Definición
Método SETUP
N/A
Método LOOP
Leer el valor del LDR
Ejecutar un tono de 1000 Hz en la bocina
Esperar un bit
Parar el tono
Esperar la cantidad de milisegundos en el valor del LDR
Arduino Code
Proteus simulation
Arduino real-life implementation