Arduino library for smooth ADC results
The SmoothADC library helps filtering ADC values when smoother evolution of values is needed (getting rid of pikes for example). 4 values, average on mid ones.
I tried to keep the lib as tiny as possible.
SmoothADC
instance (called adc
below)adc.init(Pin, Resolution, Period)
Pin
: adc pinResolution
: timing resolution (us/ms)Period
: sample rateadc.serviceADCPin()
: Method to service the ADC pin when module is enabled (should be placed somewhere in the main loop)adc.getADCVal()
: Get the average ADC pin value (should replace usual analogRead)adc.setPin(pin)
: Set ADC pin to serviceadc.setResolution(resolution)
: Set Resolution of ADC pin to service (us/ms)adc.setPeriod(period)
: Set sample rate of servicingadc.getPin()
: Get the serviced ADC pinadc.getResolution()
: Get the resolution for the serviced ADC pinadc.getPeriod()
: Get the sample rate of the serviced pinadc.enable()
: Enable ADC smoothing moduleadc.disable()
: Disable ADC smoothing moduleadc.isEnabled()
: Test if ADC smoothing is enabledadc.isDisabled()
: Test if ADC smoothing is disabledThis example defines A0 & A1 (analog inputs) to be handled by SmoothADC library
Samples every 50ms for A0
Samples every 500us for A1
Every second, the average value from A0 & A1 are sent to serial port
Doxygen doc can be generated using "Doxyfile".
See release notes