Reference: http://www.edn.com/design/power-management/4316948/LED-senses-and-displays-ambient-light-intensity# When adding reverse-bias to LED, capacitance inside LED is charged by VccCurrent at dark. When light, capacitance inside LED is charged by [VccCurrent - lightphotonCurrent]. So, capacitance's discharge time is shorter at light. Phsa's value indicate discharge time. But phsa's value is acutually not stable. My idea and code is wrong? At dark, executed 'test1' Loop cycle for test1 is 1second. Prop0 Cog6 ok test1 ****************************************************************************************************************** ************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** ********************* ********************************** ******************************************************************************** ************************************************************************************************ *************************************************************************************************************** ****************************************************************************************************************************** ******************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** ********************************************************************** *********************** ******************************************** ************************************************************************************ **************************************************************************************************** ******************************************************************************************************************** ************************************************************************************************************************************ *************************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** *************************************************************** ************************ ******************************************* ********************************************************************************* ********************************************************************************************** *********************************************************************************************************** ************************************************************************************************************************** *************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** *********************************************************************** ********************************************** *************************** ************************************** **************************************************************************** ************************************************************************************** ************************************************************************************************ ************************************************************************************************************************ *************************************************************************************************************************** ******************************************************************************************************************************** ******************************************************************************************************************************************* **************************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** **************************************************************************************************************************************************** ********************************************************************* ********************* ***************************** *********************************************************************** ****************************************************************************************** **************************************************************************************************** ********************************************************************************************************** ************************************************************************************************************************ ********************************************************************************************************************************** ****************************************************************************************************************************************** *************************************************************************************************************************************************** Prop0 Cog6 ok Value of phsa cyclically become small. I have no idea why phsa become small. At light, executed 'test1' Prop0 Cog6 ok test1 ******************* ******************* ********************* ********************** *********************** ************************ ************************* ************************** **************************** ***************************** **************************** ********************* ************ ********** ********** ********** ********** ********** ********** *********** *********** ************ ************ ************ ************ ************ ************* ************ ************ ************ ************ ************ ************* ************* ************* ************* ************* ************** ************* ************* ************* ********** ******** ******* ******* ******* ******* ******** ******** ******** ********* ********** *********** ************ ************ *************** ***************** ******************* ********************* ********************** *********************** ****************** ************* ********** ********* ********* ************** ************* Prop0 Cog6 ok