-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtomatowater.h
49 lines (41 loc) · 1.14 KB
/
tomatowater.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
// Only modify this file to include
// - function definitions (prototypes)
// - include files
// - extern variable definitions
// In the appropriate section
#ifndef _tomatowater_H_
#define _tomatowater_H_
#include "Arduino.h"
struct Plant {
const uint8_t moisture_pin;
const uint8_t pump_pin;
const String name;
const uint8_t min_moisture_percent;
const uint8_t max_moisture_percent;
const uint8_t pump_time_seconds;
const uint8_t wait_time_seconds;
const uint8_t moisture_low;
const uint8_t moisture_high;
int moisture_level;
long lastCheck;
long lastWater;
int sensorSwitchVal;
};
struct Environment {
int temperatureCelsius = 0;
int airHumidity = -1;
};
void waterPlant(int pump_trigger_pin, int waterTimeSeconds);
void waterPlant(Plant plant);
void waitForWater(int seconds);
int getMoistureLevel(Plant &plant);
int getMoisturePercentage(Plant &plant);
String getColorFromMoisture(const int moisturePercentage);
String getColorFromTemperature(const int temperatureCelsius);
Environment getEnvoirementData();
String getPageHeader();
String getPageFooter();
void handleRoot();
void handlePump();
void handleEnv();
#endif /* _tomatowater_H_ */