I'm trying to read capacitor output values as the cap discharges for a physics project, and am getting a high voltage while charging, but dropping to 0V 3000 \$\mu\$s after stopping the charging signal, which doesn't seem right.
The cap is 1mF, resistor 1k\$\Omega\$.
I'm trying to charge the cap by sending +5V out through the digital line for 2 seconds, and then trying to discharge by either switching the digital output line to high-impedance (by switching it into input mode,
pinMode(DIGITAL_OUTPUT, INPUT);) or by writing a low signal (
I've tried both methods of triggering discharge, but the analog signal that I've read (
analogRead(ANALOG_INPUT);) has gone from +5V while charging down to 0V 3000\$\mu\$s after. I was under the impression that the cap should take at least 2 seconds to fully discharge.
I assume I've messed up the circuitry somehow, and the code is actually working after enough debugging, so I haven't wasted space with 97 lines of code, but the code is in a pastebin if the circuit looks like it should work.