Let's look at the upper diagram. You'll notice a Battery symbol, which represents the circuit's power source. We connect a switch to the positive end of the battery to turn on and off the supply in the circuit. To protect the power source, one side of the switch is connected to a diode. A capacitor is connected to the diode's negative side and the circuit's ground. A resistance is connected here to protect the LED from the circuit's overcurrent.