I've got a very basic circuit using a 220μF capacitor in parallel with 5V and GND, powering an LED (see attached pic).
When I remove either the 5V and GND wire between the Arduino and the breadboard, the capacitor discharges through the LED, and it slowly fades out, as expected.
When I instead pull the serial cable and cut off the Arduino's power supply, the LED goes out instantly. Is the capacitor discharging through the Arduino (in reverse, from the Arduino's point of view)? If so, wouldn't I have to pair pretty much any capacitor I use with a diode to prevent current from flowing in reverse? That doesn't seem to be the case though, going by the tutorial circuits I've seen.
Is it harmful to the Arduino to discharge through it?
Let's say I have a decoupling capacitor parallel with an IC, no diode. Normal voltage is 5V but it momentarily drops to 4.5V. Why doesn't the same thing happen? What keeps the capacitor from discharging through the voltage source, rather than the IC?