Class for automatic handling of moving averages.
MovingAverage Class Reference
Receives a constant stream of samples and outputs the last available average. More...
#include <MovingAverage.h>
Public Member Functions | |
| MovingAverage (int number_of_samples) | |
| Creates an instance of the MovingAverage class. | |
| float | filter (float value) |
| Inserts a new value into the filter, and returns the updated average. | |
Detailed Description
Receives a constant stream of samples and outputs the last available average.
The value is in the past by half the number of averaged samples.
Definition at line 34 of file MovingAverage.h.
Constructor & Destructor Documentation
| MovingAverage | ( | int | number_of_samples ) |
Creates an instance of the MovingAverage class.
- Parameters:
-
number_of_samples Number of samples to average per output value. Maximum value is 64.
Definition at line 3 of file MovingAverage.cpp.
Member Function Documentation
| float filter | ( | float | value ) |
Inserts a new value into the filter, and returns the updated average.
- Parameters:
-
value The new value to be inserted.
- Returns:
- The updated average including the new value.
Definition at line 9 of file MovingAverage.cpp.
Generated on Mon Jul 18 2022 08:52:40 by
1.7.2