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
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
- Add a “when flag clicked” event from the events palette.
- Place a “forever” block from the controls palette after the event block.
- Within the “forever” block, add a “say()” block from the looks palette.
- From the Arduino sensor palette, drag the “read analog sensor () at ()” block and insert it in place of “hello” in the “say()” block.