Quote:
Originally Posted by Mr. Rogers
I thought about an average value too, but our programmers don't know how to implement that.
|
If you use an infinite impulse response filter, it is very simple to do:
new_filtered_value = K*previous_filtered_value + (1-K)* new_sample
... that's all there is to it.
"K" is a tuning constant, which you use to adjust the "strength" of the filter. K must be in the range zero to +1. When K=0, there is no filtering. When K=1, the filtering is so "strong" that the filtered value never changes.