The LDR sensor and the way it works

An LDR sensor is an analog input sensor that consists of a variable resistor whose resistance varies depending on the amount of light falling on its surface. When there is no light in the room, the resistance of the LDR sensor is HIGH (up to 1 M ohm) and in the presence of light, the resistance of the LDR sensor is LOW. The LDR sensor consists of two pins. These pins do not have positive and negative polarity. We can use any pin as a data or ground pin and because of this, the LDR sensor is sometimes referred to as a special type resistor. The image of the LDR sensor is shown in the following photo:

Since ...

Get Hands-On Robotics Programming with C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.