You have a plan to build a games console controller thatcaptures the hand gestures of the player. The player’s movementsand gestures are sensed using an accelerometer connected to one ofthe ADC pins of an Arduino. You have already written all thenecessary code but have yet to include any kind of smoothing forthe accelerometer signal.
Your task now is to write the accelerometer smoothing function.The function must take each new sample as input and return theaverage of 4 consecutive samples without introducing a significantlag. (Hint: use a moving average.)
Write an implementation of this function where the functionprototype is of the form:
int SmoothSensor(int sensorReading);