A distance sensor is the most important sensor for any robot. It's usually referred to as the "eyes" of a robot. Distance sensors are very useful as we can make systems that react based on how close we are to them or based on the presence of various obstacles.
There are two common technologies used in amateur distance sensing: infrared sensors, such as the classic Sharp IR, and ultrasonic sensors, usually called sonars. Now, let's build a distance-controlled LED!
To build a distance-controlled LED, we will need the following ingredients: