Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
EMAVDivSampler.h
1 #pragma once
2 
3 #include <stdint.h>
4 #include <EMASampler.h>
5 
10 class EMAVDivSampler : public EMASampler {
11 public:
21  EMAVDivSampler(const uint8_t pin,
22  const uint16_t r1KOhm,
23  const uint16_t r2KOhm,
24  const float vRef,
25  const uint16_t periodMs,
26  const float alpha);
27 
29  virtual float averageVolts();
30 
32  virtual float lastVolts();
33 
34 protected:
35  uint16_t _r1KOhm;
36  uint16_t _r2KOhm;
37  float _vRef;
38 
39 };
40 
virtual float averageVolts()
Get the mean value in the sample set.
uint8_t pin()
Accessor for the pin which is geting read from.
Exponential Moving Average (EMA) analog pin sampler.
Definition: EMASampler.h:28
EMAVDivSampler(const uint8_t pin, const uint16_t r1KOhm, const uint16_t r2KOhm, const float vRef, const uint16_t periodMs, const float alpha)
Exponential Moving Average Voltage Divider based voltage sampler.
virtual float lastVolts()
Get the most recent voltage value.