Capacitor C first charges through the pull-up resistance of the microcontroller's I/O pin configured as an output (a). The capacitor then discharges through the reverse leakage of diode D (b)
Figure 2. Capacitor C first charges through the pull-up resistance of the microcontroller's I/O pin configured as an output (a). The capacitor then discharges through the reverse leakage of diode D (b)