Studying Capacitor
The RC circuit
under study is connected between the Digital output socket D3 and
Ground. The voltage across the capacitor is monitored by the ADC
channel 0. The voltage on D3 can be set to 0V or 5V under software
control. Taking D3 to 5V will make the capacitor charge to 5V through
the resistor R and then taking D3 to 0V will cause it to discharge. All
we need to do is digitize the voltage across C just after changing the
output of D3.