In this article you will find out what an IR sensor D is and how to use it

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.
Technical description:

– Size (L*W*H): 40x24x24
– (PIN D) The sensor registers the reflection of the light signal and changes the value of PIN D 1\0 (White\Black color)
– Operating voltage: 5V
– XH 3pin connector for connecting to another device

Functionality when connected to RED X controller:

The infrared sensor registers the amount of reflected infrared light.

IR sensor (D) connecting scheme

RED Code Example
*Physically, if the IR sensor D sensor connected to port D2 reads white colour, then the servomotor connected to port D1 rotates by zero degree, otherwise the servomotor rotates by 180 degrees

Technical support

© R:ED – Robotics Education. All rights reserved