For my computation class, we were asked to give a presentation and some sample code for smoothing an IR sensor in the Arduino environment. I wrote this code that averages the values of the last ten readings. It drops the highest and lowest values, to help control the noise and make sure that it does not influence the averaging.