Please see examples
folder
#include "mbed.h"
#include "MovingAverageFloat.h"
// Buffer will be 16 samples long, it will take 16 * sizeof(float) = 64 bytes of RAM
MovingAverageFloat <16> filter;
int main() {
printf("result: %.2f\n", filter.add(1.5)); // insert new number and get result
printf("result: %.2f\n", filter.add(2.5)); // insert new number and get result
printf("result: %.2f\n", filter.add(2.4)); // insert new number and get result
printf("result: %.2f\n", filter.get()); // get last result, without adding a newone
return 0;
}
result: 1.50
result: 1.56
result: 1.62
result: 1.62