See this article in Arduino playground about running average:
https://playground.arduino.cc/Main/RunningAverage