This is a Processor Expert project created by CodeWarrior for MCUs v10.6 which implements the charge-discharge time of a RC circuit for measuring capacitance.
The charge-discharge sequence is performed by TPM0 operating in PWM mode, while the time is measured by TPM1 operating in Input Capture mode.
A 100K ohm series resistor is being used, and the result is expressed on nF. It is also using the LCDHTA component from Erich Styger for showing the measurements on a 16x2 LCD, connected to the FRDM-KL05Z through a proto shield.
The project is attached, and the pictures shows the measurements of three different capacitors: 10nF, 47nF and 1uF.
You might find this old project from MERL - Mitsubishi Electric Research Laboratories of interest:
http://www.merl.com/publications/docs/TR2003-35.pdf
"Very Low-Cost Sensing and Communication
Using Bidirectional LEDs" by
Paul Dietz, William Yerazunis, Darren Leigh
TR2003-35 July 2003
Replace your capacitor with a LED. The capacitance of the LED varies with the incident light on it.