03 Distance light intensity control
In this circuit, the proximity sensor acts as a regulator for LED bulb. Here -
- If an object is less than 5cm distance from the sensor, the LED will glow with full intensity 
- If an object is between 5cm to 30cm distance from the sensor, LED will change intensity based on distance 
- If there is no object within 30cm from sensor, LED will turn off. 
Circuit diagram
(credits: https://www.circuito.io/)

Here, you can connect resistor and LED to board directly without breadboard. If you do not have LED, replace 5 with 13 in the code below which will make the on-board LED blink.