Goal:
The goal of this project is to build a LED light that will light up when the environment is dark and senses people approach.
Components:
red led x1
green led x1
resistor(200Ω) x1
resistor(10kΩ) x1
photocell x1
arduino board & breadboard
How it works
The photocell will first sense the light in the room. If the data is less that 700 and the distance that UltraSensor sense is less that 10, the light will turn on.
Code: https://github.com/joycemolly/pcomp–lock-combination/blob/master/homeworkLock.ino