-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhydro.h.sample
101 lines (86 loc) · 2 KB
/
hydro.h.sample
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
#include "sysconfig.h"
#ifdef _HAS_THINGSPEAK
unsigned long channelId = 1;
const char *writeApiKey = "XXXXXXXXXXXX";
#include <ThingSpeak.h>
#endif
#ifdef _HAS_ETHERNET
#include "Ethernet.h"
byte mac[] = { 0x02, 0x60, 0x8c, 0x01, 0x02, 0x05 };
IPAddress ip(192, 168, 1, 2);
IPAddress dns(8, 8, 8, 8);
#ifndef _HAS_WIRELESS
EthernetClient(client);
#endif
#endif
#ifdef _HAS_WIFI
#ifdef _HAS_WIFI_ESP
#include <WiFiEsp.h>
#ifndef _HAS_ETHERNET
WiFiEspClient client;
#endif
#endif
char ssid[] = "SSID";
char pass[] = "Password";
#endif
#ifdef _HAS_DHT
#include <DHT.h>
#include <DHT_U.h>
#define DHT_PIN 3
#define DHT_TYPE DHT11
DHT dht(DHT_PIN, DHT_TYPE);
#endif
#ifdef _HAS_DALLAS
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 2
OneWire oneWireBus(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWireBus);
float fluidAlarmLow = 8.0;
float fluidAlarmHigh = 30.0;
#ifdef _HAS_EC
#define PIN_EC A1
#define EC_POWER_PIN 6
#define EC_SINK_PIN 7
float readEc(float fluidTemp);
#endif
#endif
#ifdef _HAS_PUMP_RELAY
#define PIN_PUMP 4
int idlePump = 1;
#endif
#ifdef _HAS_LAMP_RELAY
#define PIN_LAMP 5
#endif
#ifdef _HAS_PH
#define PIN_PH A0
#endif
#ifdef _HAS_VBATT
#define PIN_VBATT A2
// Adjust this value to suit the output from your voltage divider
// This works for R1 = 10K, R2 = 1K (gives .09)
float batFactor = 35.556;
#endif
#ifdef _HAS_SSD1306
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for SSD1306 display connected using software SPI (default case):
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
#endif
#ifdef _HAS_DS1307
#include <RTClib.h>
RTC_DS1307 rtc;
#endif
#define RLY_OFF HIGH
#define RLY_ON LOW
// Internal defs
int stat = 1;
int secs = 0;
int mins = 0;