Table of Contents
Example Description
Discover the fascinating LDR (Light Dependent Resistor), an analog-type sensor that alters its resistance with varying light intensity
Introduction

LDR, also known as a Light Dependent Resistor, is an analog-type sensor renowned for its ability to modify its resistance based on the intensity of incident light. As the surrounding light changes, the resistance of the LDR fluctuates, making it an essential component in various light-sensing applications. While generally designed as a two-pin sensor, it is also available in a three-pin module, providing enhanced features and flexibility.

circuit

How To Use An LDR Sensor With Arduino Tutorial 1

in this example, we will interface our sensor module with Arduino and we’ll be reading the change in it’s resistance upon the change of light.

Code

  1. Add a “when flag clicked” event from the events palette.
  2. Place a “forever” block from the controls palette after the event block.
  3. Within the “forever” block, add a “say()” block from the looks palette.
  4. From the Arduino sensor palette, drag the “read analog sensor () at ()” block and insert it in place of “hello” in the “say()” block.

Output