4 #include <AbstractSampler.h> 30 BufferedSampler(
const uint8_t
pin,
const uint16_t periodMs=10,
const uint8_t samples=10);
72 virtual int16_t
last();
virtual int16_t last()
Get the most recent sample value.
uint32_t _lastUpdated
when last sample taken
int16_t * _sampleData
ring buffer for data
uint8_t _samples
max number of samples to keep in buffer
uint8_t _count
number of samples in buffer
virtual int16_t maximum()
The maximum value in the sample set.
float _mean
most recently calculated mean value
uint8_t pin()
Accessor for the pin which is geting read from.
virtual int16_t minimum()
The minimum value in the sample set.
int16_t _minimum
most recently calculated minimum value
BufferedSampler(const uint8_t pin, const uint16_t periodMs=10, const uint8_t samples=10)
bool _updated
flag to re-calulate avg or not
Base class for analog pin sampling classes.
int16_t _maximum
most recently calculated maximum value
Ringbuffer-based sampler for analog values.
virtual float average()
Get the mean value in the sample set.
virtual void calculate()
calculate avg, min, max if required
uint8_t _idx
index ptr (ring buffer)