Assignment 7 | Close your eyes when the flash is on

Concept

For this assignment, I am imitating the interaction between a camera’s shutter release and the human eye’s reaction to a camera flash. The button represents the shutter release, while the LDR simulates ambient light or flash. The LEDs mimic how the human eye might react to sudden changes in light.

When the button (shutter release) is pressed, it activates the LEDs: the digital LED turns on fully, and the analog LED adjusts its brightness based on the light level detected by the LDR. If the surrounding light level is high, the LED immediately dims, simulating the eye’s reaction to bright flashes.

Implementation

Code

https://github.com/LindaD1234/Intro-To-IM/blob/039cec5b83542a4788a6a4ae24d2adfc22e446ca/Assignment%207

One new thing I discovered is the INPUT_PULLUP, which makes it easy to work with buttons and switches without needing an external resistor.

Leave a Reply