Multi-analog output value smoothing function

Rather than using a class, you may also pass pointers to the variables so they get updated in place.

int newTotal, newReadIndex, newAverage;
smoothValue(&newTotal, &newReadIndex, &newAverage);

void smoothValue(int *newTotal, int *newReadIndex, int *newAverage) { // You may chose other names if you like here.
  ...
  return;
}