-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBiodome.h
110 lines (98 loc) · 2.74 KB
/
Biodome.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#ifndef Biodome_h
#define Biodome_h
#define STATUS_OFF 0
#define STATUS_ON 1
#include "WProgram.h"
//==========================================================================//
// Environment
//==========================================================================//
struct Environment
{
int target;
int over;
int extremeOver;
int under;
};
//==========================================================================//
// Device
//==========================================================================//
class Device
{
public:
char * name;
int status; // 0=off;1=on
int queuedStatus; // 0=off;1=on
int pin;
boolean inverted;
void configure(int outPin, boolean isControlInverted);
void turnOn();
void turnOff();
void nextStatus();
};
//==========================================================================//
// Sensor
//==========================================================================//
class Sensor
{
public:
char * name;
virtual void update() {};
void configure(char * sensorName, float measurementCompensation);
inline void begin() {};
inline float read() { return _lastValue + _compensation;};
protected:
float _lastValue;
float _compensation;
};
//==========================================================================//
// Facade Sensor
//==========================================================================//
// Provide Sensor API to output from an external class or library
class FacadeSensor : public Sensor
{
public:
void update();
void updateExternal(float input);
};
//==========================================================================//
// TEMPERATURE sensor - TMP36
//==========================================================================//
class TemperatureSensor : public Sensor
{
public:
TemperatureSensor(byte pin);
void update();
byte pin;
};
//==========================================================================//
// TEMPERATURE sensor - TMP36
//==========================================================================//
class LM335TemperatureSensor : public Sensor
{
public:
LM335TemperatureSensor(byte pin);
void update();
byte pin;
};
//==========================================================================//
// Soil Moisture Sensor
//==========================================================================//
class SoilMoistureSensor : public Sensor
{
public:
SoilMoistureSensor(byte aPin, byte dPin);
void update();
byte aPin;
byte dPin;
};
//==========================================================================//
// LIGHT sensor - LDR
//==========================================================================//
class LightSensor : public Sensor
{
public:
LightSensor(byte aPin);
void update();
byte aPin;
};
#endif