added averaging of the adc value.