A light sensor circuit based on direct connection of LEDs to I/O pins of a
microcontroller. The LEDs are reverse biased and the parasitic junction
capacitance is charged in an output mode. Then, the I/O pins placed into
an high-impedance input mode. The time for the capacitance to be
discharged by photoconduction caused by light incident on the LEDs is
inversely proportional to an intensity of the incident light, and can be
directly measured as the time required for the I/O pin to transition from
fully-charged (5 volts) to a logic threshold level (1.7 volts). By using
multiple LEDs, multiplexed between emissive and sensing modes, a wide
variety of sensors can be constructed, particularly, when the LEDs emit
light at different wavelength.