Added averaging for light sensor readings.
Added averaging of light sensor readings.  Also fixed compile errors.