When this circuit is connected correctly, the light should fade in when you push the button and fade out when you release the button.
The Circuit
When you push the button, the capacitor starts to charge through resistor R1. As the capacitor charges, the LED will go from off to gradually turning on.
When you release the button, the battery gets disconnected and the LED gets powered by the capacitor instead. As the capacitor discharges, the voltage across it decreases and the LED fades out.
Parts List
| Reference | Value |
|---|---|
| BAT1 | 9V |
| C1 | 1000µF |
| D1 | Light-Emitting Diode (LED) |
| R1 | 470 |
| R2 | 470 |
| SW1 | Pushbutton |
The Layout
Here's one way to connect this circuit on a breadboard.