The sensor contains 2 elements: an infrared LED that emits light in the infrared range, and a sensitive photocell. If there is a reflective surface near the sensor, part of the light returns to the photocell. The closer the surface and the “whiter” it is, the more light returns to the receiver, the higher the sensor readings. The sensor transmits the value 0 and 1.
The IR sensor D is Lego- and Arduino-compatible.