template <uint16_t depth>
class

This is a class built upon the standard mbed::AnalogIn class, that include running average low pass filtering.

In almost all cases you should low pass filter an incoming analog signal, to remove high frequency noise. This class is a convenient way to do that. It uses the RunningAverageFilter to filter all incoming samples.

Just like the RunningAverageFilter, this class is templated with the length of the low pass filter.

Example

Here we create 32 sample long filter, attached to the 3.5mm jack connector input pin:

FilteredAnalogIn<32> input(J_RING1);


See
RunningAverageFilter

Public Functions

mono::io::FilteredAnalogIn::FilteredAnalogIn(PinName pin)

Create an AnalogIn, connected to the specified pin.

Parameters
• pin -

float mono::io::FilteredAnalogIn::read()

Read the input voltage, represented as a float in the range [0.0, 1.0].

The value is filtered through a running average filter Complexity: O(1)

Return
A floating-point value representing the current input voltage, measured as a percentage

unsigned short mono::io::FilteredAnalogIn::read_u16()

Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF].

The value is filtered through a running average filter Complexity: O(1)

Return
16-bit unsigned short representing the current input voltage, normalised to a 16-bit value