Light Sensor Experiments
After completing the Light Sensor project, test yourself by trying these experiments.
1 | Make a night light to turn on a LED when it is dark and turn off when it is bright.
Use the middle number that you calculated in the previous step for the cut off point. The middle number 600 is used in the example. Your number might be different. The light sensor is connected to pin A0 on the Arduino board. We will use the internal LED that is connected to pin 13 on the Arduino board. The otherwise the second | |
2 | The light sensor program in Experiment 1 turns on the LED when it is dark. Modify the program so that it turns on the LED when it is light. | |
3 | Write a program to control the brightness of a LED depending on the amount of light in a room. Make the LED brighter when the amount of light in the room is darker. | |
4 | Write a program to control the blinking speed of a LED depending on the amount of light in a room. Make the LED blinking speed faster when the amount of light in the room is darker. | |
5 | Create a dark sensor alarm. When the light value drops below a certain threshold it will sound an audible alarm. The alarm remains on until the light value rises back above the threshold. For example, if the current light value is 600, then you can set the threshold to be 570. | |