-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.ino
142 lines (129 loc) · 3.31 KB
/
display.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
void display ()
{
lcd.setCursor(0, 0);
// orologio ();
if (H == true) {
lcd.setCursor (17, 0);
lcd.print(" ON");
}
else {
lcd.setCursor (17, 0);
lcd.print("OFF");
}
lcd.setCursor(0, 1);
lcd.write(pentola);
lcd.print(" ");
lcd.write(termometro);
lcd.print(cucina, 1); // measured temperature
lcd.print(char( 223)); // Scrive il pallino dei gradi
lcd.print("C ");
lcd.write(goccia);
lcd.print(" ");
lcd.print(h0, 1);
lcd.print("%");
lcd.setCursor(0, 2);
lcd.write(notte);
lcd.print(" ");
lcd.write(termometro);
lcd.print(camera, 1);
lcd.print(char( 223)); // Scrive il pallino dei gradi
lcd.print("C ");
lcd.print("EXT ");
if (ext < 10)
{
lcd.print(" "); //insert leading zero if ext temp value is less than 10
lcd.print(ext,1);
}
else lcd.print(ext,1); //display current ext temp
lcd.print(char( 223)); // Scrive il pallino dei gradi
lcd.print("C");
lcd.setCursor(0, 3); //quarta riga, primo carattere
if (S == false) {
lcd.print(" TERMOSTATO SPENTO");
lcd.setCursor(0, 0);
orologio();
}
else {
lcd.print("MAN ");
lcd.write(termometro);
lcd.print(" ");
lcd.print(Td, 1);
lcd.print(char( 223)); // Scrive il pallino dei gradi
lcd.print("C ");
if ((Td > Tc) && S && !ER && !H) //
{ //
lcd.setCursor(0, 0);
lcd.print("ON tra: "); //
lcd.print(HeaterStatusDelay - Von * 1 ); // IF THE RELE STATUS IS GOING TO CHANGE IT WILL DISPLAY A COUNTDOWD ON THE LAS T LINE OF THE LCD
lcd.print(" sec "); //
} //
else {
if (((Td < Tc) || !S || ER) && H)
{
lcd.setCursor(0, 0);
lcd.print("OFF tra: ");
lcd.print(HeaterStatusDelay - Voff * 1);
lcd.print(" sec ");
}
else {
lcd.setCursor(0, 0);
orologio ();
}
}
}
DateTime now = RTC.now();
if (digitalRead(pirPin) == HIGH)
{
lcd.on();
}
if (digitalRead(pirPin) == LOW)
{
lcd.off();
}
}
void orologio()
{
DateTime now = RTC.now();
// start = RTC.now();
Hour = (now.hour());
if (Hour < 10)
{
lcd.print("0"); //insert leading zero if hour value is less than 10
lcd.print(Hour);
}
else lcd.print(Hour); //display current hour
lcd.print(':');
Minute = (now.minute()); //display current hour
if (Minute < 10)
{
lcd.print("0"); //insert leading zero if minute value is less than 10
lcd.print(Minute);
}
else lcd.print(Minute); //display current minute
lcd.print(":");
Second = (now.second());
if (Second < 10)
{
lcd.print("0"); //insert leading zero if seconds value is less than 10
lcd.print(Second); //display current seconds
}
else lcd.print(Second); //display current seconds
lcd.print(" ");
giorno = (now.day());
if (giorno < 10)
{
lcd.print("0"); //insert leading zero if day value is less than 10
lcd.print(giorno);
}
else lcd.print(giorno); //display current day
// lcd.print(now.day(), DEC);
lcd.print('-');
mese = (now.month());
if (mese < 10)
{
lcd.print("0"); //insert leading zero if month value is less than 10
lcd.print(mese);
}
else lcd.print(mese); //display current month
lcd.print(" ");
}