-
Notifications
You must be signed in to change notification settings - Fork 0
/
aqua.ino
124 lines (102 loc) · 2.42 KB
/
aqua.ino
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
111
112
113
114
115
116
117
118
119
120
121
122
123
#include "TimerObject.h"
const long LED_t = 900000L; // 15min*60000 = 900000
const long mais_t = 600000L; // 10min*60000
const long BURB_t = 9000000L; // 90min*60000 = 5400000
const long LED_t1 = 2700000L; // 45min*60000 = 2700000
const long delay_t= 900000L; // 15min*60000
const long total_t = LED_t + BURB_t + LED_t1;
unsigned long LastTime_mill;
TimerObject *timer1 = new TimerObject(LED_t);
TimerObject *timer2 = new TimerObject(BURB_t);
TimerObject *timer3 = new TimerObject(LED_t1);
TimerObject *timer4 = new TimerObject(delay_t);
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
//Reles 26, 28, 30, 32
#define SVIES 28
#define BURB 26
#define HEAT 30
#define REL4 32
#define butt A10 //buttons
int buttVal = 0;
boolean MAISTAS = true;
boolean VYKDYMAS = false;
boolean RUNNING = false;
boolean HEATER = false;
boolean BACKLIGTH = false;
void setup() {
Serial.begin(9600);
timer1->setOnTimer(&BURB_on);
timer1->setSingleShot(true);
timer2->setOnTimer(&BURB_off);
timer2->setSingleShot(true);
timer3->setOnTimer(&LED_off);
timer3->setSingleShot(true);
timer4->setOnTimer(&delay_off);
timer4->setSingleShot(true);
pinMode(SVIES, OUTPUT);
digitalWrite(SVIES, HIGH);
pinMode(BURB, OUTPUT);
digitalWrite(BURB, HIGH);
pinMode(HEAT, OUTPUT);
digitalWrite(HEAT, HIGH);
pinMode(REL4, OUTPUT);
digitalWrite(REL4, HIGH);
lcd.begin();
lcd.backlight();
lcd.setBacklight(LOW);
}
void loop() {
readButt();
if (VYKDYMAS == true && RUNNING == false){
RUNNING = true;
LED_on();
LastTime_mill = millis();
}else{
timer1->Update();
timer2->Update();
timer3->Update();
timer4->Update();
}
}
void readButt()
{
buttVal = analogRead(butt);
Serial.println(buttVal);
if(buttVal > 870 && buttVal < 880){
delay(100);
}else if(buttVal > 495 && buttVal < 505){
delay(100);
if(MAISTAS == true){
MAISTAS = false;
}else{
MAISTAS = true;
}
}else if(buttVal > 485 && buttVal < 495){
delay(100);
if(VYKDYMAS == false){
VYKDYMAS = true;
}
}
}
void LED_on(){
timer1->Start();
digitalWrite(SVIES, LOW);
}
void BURB_on(){
timer2->Start();
digitalWrite(BURB, LOW);
}
void BURB_off(){
timer3->Start();
digitalWrite(BURB, HIGH);
}
void LED_off(){
timer4->Start();
digitalWrite(SVIES, HIGH);
digitalWrite(BURB, HIGH);
}
void delay_off(){
VYKDYMAS = false;
RUNNING = false;
}