Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: sensor.h
- Revision:
- 37:1251e35fe43e
- Parent:
- 34:e67581c9b50d
- Child:
- 50:e83e38fece23
diff -r e67581c9b50d -r 1251e35fe43e sensor.h
--- a/sensor.h Tue Jan 17 11:44:16 2017 +0100
+++ b/sensor.h Tue Jan 17 12:00:43 2017 +0100
@@ -3,11 +3,12 @@
class Sensor {
public:
explicit Sensor(SENSOR_TYPE id);
-
+
virtual void updateState() = 0;
virtual Data dataToSend() = 0;
virtual void resetState() = 0;
-
+ SENSOR_TYPE getId() { return sensor_id_; };
+
protected:
SENSOR_TYPE sensor_id_;
};
@@ -15,11 +16,11 @@
class DigitalSensor: public Sensor {
public:
explicit DigitalSensor(SENSOR_TYPE id, PinName pin=PA_10);
-
+
virtual void updateState();
virtual Data dataToSend();
virtual void resetState();
-
+
static const float SEND_INTERVAL;
private:
DigitalIn sensor_;
@@ -30,11 +31,11 @@
class AnalogSensor: public Sensor {
public:
explicit AnalogSensor(SENSOR_TYPE id, PinName pin=PA_4);
-
+
virtual void updateState();
virtual Data dataToSend();
virtual void resetState();
-
+
static const float SEND_INTERVAL;
private:
AnalogIn sensor_;