Goal:
- If the environment is bright, the LED won’t light up.
- If the environment is dark but the distance is far away, the LED won’t light up.
- If the environment is dark and the distance is close, the LED will light up.
List:
- 1x Yellow LED
- 1x Ultrasonic sensor
- 1x Photocell
- 1x Resistors (220 ohms) – resistor
- 1x Resistors (10K ohms) – photocell
Arduino Code:
https://github.com/yuemelz/pcom2018/blob/master/photocell_distance.ino