Fridolin  1.2
DieBitschubser
Sensor.h
gehe zur Dokumentation dieser Datei
1 #pragma once
2 
3 #include "Arduino.h"
4 
5 
14 namespace STFU
15 {
20 class Sensor
21 {
22 public:
26  Sensor() = delete;
31  explicit Sensor(int s);
32 
36  virtual ~Sensor() = default;
37 
42  // return type überladen geht nicht, andere lösung?
43  //virtual bool read() const;
44 
45 protected:
47  const int _pin;
48 };
49 
50 
51 
57 {
58 public:
63  explicit DigitalSensor(int);
64 
69  bool read() const;
70 };
71 
72 
78 {
79 public:
81  static const int MAX_VALUE = 1023;
83  static const int MIN_VALUE = 0;
84 
89  explicit AnalogSensor(int);
90 
95  int read() const;
96 };
97 
98 
103 class InfraredSensor final : public AnalogSensor
104 {
105 public:
109  InfraredSensor() = delete;
114  explicit InfraredSensor(int);
115 
120  int distance() const;
121 };
122 
123 }
int read() const
Abfrage des Sensorwertes.
Definition: Sensor.cpp:26
DigitalSensor(int)
Konstruktor mit Pinbelegung fuer Messung.
Definition: Sensor.cpp:13
Abgelteitete Sensorenklasse für Infrarotsensoren.
Definition: Sensor.h:103
Basisklasse als Interface für die Sensoren.
Definition: Sensor.h:20
static const int MAX_VALUE
Maximaler Sensorwert.
Definition: Sensor.h:81
Abgelteitete Sensorenklasse für analoge Sensoren.
Definition: Sensor.h:77
Abgelteitete Sensorenklasse für digitale Sensoren.
Definition: Sensor.h:56
bool read() const
Abfrage des Sensorwertes.
Definition: Sensor.cpp:16
InfraredSensor()=delete
Der Defaultkonstruktor ist verboten.
static const int MIN_VALUE
Minimaler Sensorwert.
Definition: Sensor.h:83
Super Tolle Fridolin Utilities Alle Klassen aus dieser Bibliothek haben den Präfix: STFU.
Definition: Button.cpp:3
const int _pin
Abfrage des Sensorwertes.
Definition: Sensor.h:47
virtual ~Sensor()=default
Der Destruktor ist default.
int distance() const
Abfrage der messbaren Distanz des Sensors.
Definition: Sensor.cpp:36
Sensor()=delete
Der Defaultkonstruktor ist verboten.
AnalogSensor(int)
Konstruktor mit Pinbelegung fuer Messung.
Definition: Sensor.cpp:23