FastPWM library, modified by benkatz

Dependents:   WangBoard_MotorScience

Fork of FastPWM3 by Ben Katz

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers filters.cpp Source File

filters.cpp

00001 #include "filters.h"
00002 
00003 MeanFilter::MeanFilter(float strength) {
00004     _strength = strength;
00005     _mean = 0;
00006 }
00007 
00008 float MeanFilter::Update(float x) {
00009     return _mean = _strength * _mean + (1.0f - _strength) * x;
00010 }