Loading [MathJax]/jax/output/HTML-CSS/config.js
SensESP 3.1.0
Universal Signal K sensor toolkit ESP32
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
analog_reader.h
Go to the documentation of this file.
1#ifndef SENSESP_SENSORS_ANALOG_READER_H_
2#define SENSESP_SENSORS_ANALOG_READER_H_
3
4#include "sensesp.h"
5
6#include "Arduino.h"
7
8namespace sensesp {
9
14 private:
15 int output_scale_;
16
17 public:
18 virtual float read() = 0;
19};
20
22 protected:
23 int pin_;
24
25 public:
26 ESP32AnalogReader(int pin) : pin_{pin} {}
27
28 float read() { return analogRead(pin_); }
29};
31
32} // namespace sensesp
33
34#endif
Used by AnalogInput as a hardware abstraction layer.
virtual float read()=0
ESP32AnalogReader AnalogReader