SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
analog_input.h
Go to the documentation of this file.
1#ifndef SENSESP_SENSORS_ANALOG_INPUT_H_
2#define SENSESP_SENSORS_ANALOG_INPUT_H_
3
4#include <memory>
5#include "analog_reader.h"
7#include "sensor.h"
8
9namespace sensesp {
10
43class AnalogInput : public FloatSensor {
44 public:
45 AnalogInput(uint8_t pin = A0, unsigned int read_delay = 200,
46 const String& config_path = "", float output_scale = 1024.);
47
48 virtual bool to_json(JsonObject& root) override;
49 virtual bool from_json(const JsonObject& config) override;
50
51 protected:
52 uint8_t pin{};
53 unsigned int read_delay;
55 std::unique_ptr<BaseAnalogReader> analog_reader_{};
56 void update();
57};
58
59const String ConfigSchema(AnalogInput& obj);
60
61inline bool ConfigRequiresRestart(const AnalogInput& obj) { return true; }
62
63} // namespace sensesp
64
65#endif
Sensor for reading the MCU analog input pins.
std::unique_ptr< BaseAnalogReader > analog_reader_
virtual bool from_json(const JsonObject &config) override
virtual bool to_json(JsonObject &root) override
AnalogInput(uint8_t pin=A0, unsigned int read_delay=200, const String &config_path="", float output_scale=1024.)
unsigned int read_delay
Sensor template class for any sensor producing actual values.
Definition sensor.h:40
const String ConfigSchema(const SmartSwitchController &obj)
bool ConfigRequiresRestart(const HTTPServer &obj)