Image Courtesy of Adafruit
This analog IR distance sensor can be used to determine distance from the sensor to an object. You must either buy a distance sensor with the cable, or buy a separate 3 pin JST connector wire to use it. The red wire connects to 5V, the black wire connects to ground, and the white wire returns an analog voltage between 0 and 5V proportional to the distance measured. The Arduino’s ADC can be used to read and use this analog signal.