Inputs and outputs: LDR sensor
Turn a led on when ambient light is low
What are we going to do?
In this activity you'll write some code that turn a led on o off when ambient light is low. We will achieve this thanks to a LDR sensor brick or LDR circuit.
You can use the code from Arduino IDE -> File -> Examples -> Digital -> Button but you'll need to change some parts.
Let's get started
Follow these instructions carefully. You can click on some of the images to zoom in.
Always connect the components BEFORE powering the UNO board or YOU MAY DAMAGE YOUR BOARD OR COMPONENTS.
Now, what else?
Now is your turn:
- Think about how would you modify the code so the sensor acts differently depending on the ambient light.
- Do you have any real life application for this kind of circuit?