For tasks like smoothing ADC values I would suggest something very simple like
xout := xout*k + xin*(1-k);
That is just a variation of
SimpleIntegrate() function, which was not written as a one liner for the sake of clarity. I prefer
SimpleIntegrate() form because it is very clear that if you feed the function with the same
NewVal for
factor number of iterations, result will reach the value of
NewVal.