Bonjour tout le monde
Je suis nouveau ici et je suis autodidacte sur l'Arduino et débutant dans l'électronique en général voila pour une courte présentation
Mon problème :
j'ai utilisé un Arduino méga marque ELEGOO hein le matos ça compte ;p j'ai créé un "programme" pour un système de chauffage (gestion chaudière bois, ecs)
tout marche bien mais par moment de manière aléatoire ça plante et se fige, plus de réaction de l'Arduino du coup surchauffe de la chaudière bon je vais ajouter des thermostats mécaniques de sécurité au cas où mais j'aimerais comprendre mon problème
donc en matos j'ai
  • un Arduino méga
  • un écran 3.5" tactile
  • 4 sonde 18B20
  • 4 relais pour l'alimentation j'utilise un chargeur de téléphone 5V 2A


pour le code je pense qu'il peut être amélioré comme mon orthographe mais j'ai pas les capacités à ce jour

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
/********************************************************************************************
Information utile pour raccordement 
K0 = sortie 26 circulateur chaudière bois 
K1 = sortie 27 circulateur radiateur
K2 = sortie 28 circulateur eau chaude sanitaire
K3 = sortie 29 By passe radiateur
sonde brancher sur 14
*********************************************************************************************/
 
#include <EEPROM.h>                                                      // librairy pour utiliser la mémoir interne
#include <MCUFRIEND_kbv.h>                                               // librairy pour l'écran
MCUFRIEND_kbv tft;                                                       // librairy pour l'écran
#include <TouchScreen.h>                                                 // librairy pour le tactile
#include "Adafruit_GFX.h"                                                // librairy pour l'écran
#include <Wire.h>                                                        // librairy pour bus de communication
#include <OneWire.h>                                                     // librairy pour le bus de comunication 
#include <DallasTemperature.h>                                           // librairy pour les sonde de temperature 
DeviceAddress sensorDeviceAddress;                                       // Vérifie la compatibilité des capteurs avec la librairie
uint16_t ID, oldcolor, currentcolor;                                     //
int tempV1;                                                              //
int tempV2;                                                              //
int tempV3;                                                              //
int tempV4;                                                              //
                                                                         //
 // écran tactil //                                                      //
#define LCD_CS A3                                                        // Chip Select goes to Analog 3
#define LCD_CD A2                                                        // Command/Data goes to Analog 2
#define LCD_WR A1                                                        // LCD Write goes to Analog 1
#define LCD_RD A0                                                        // LCD Read goes to Analog 0
#define LCD_RESET A4                                                     // Can alternately just connect to Arduino's reset pin
#define LCDROTATION    1                                                 //
#define YP A3                                                            // must be an analog pin, use "An" notation!
#define XM A2                                                            // must be an analog pin, use "An" notation!
#define YM 9                                                             // can be a digital pin
#define XP 8                                                             // can be a digital pin
#define TS_MINX 150                                                      //  150
#define TS_MINY 120                                                      //  120
#define TS_MAXX 920                                                      //  920
#define TS_MAXY 940                                                      //  940
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);                       //
#define MINPRESSURE 10                                                   //
#define MAXPRESSURE 1000                                                 //
                                                                         //
 // couleur écran //                                                     //
#define BLACK           0xFFFF                                           //
#define WHITE           0x0000                                           //
#define BLUE            0xEEE0                                           //
#define RED             0x07FF                                           //
#define GREEN           0xF81F                                           //
#define YELLOW          0x001F                                           //
#define ORANGE          0x053C                                           // 
#define GREY            0x39C7                                           //
                                                                         //
// temporisatio                                                          //
unsigned long previousMillisPaf = 0;                                     //
unsigned long previousMillisPif = 0;                                     //
unsigned long tempo1 = 2000;                                             //
unsigned long tempo2 = 0;                                                //
                                                                         //
//Menu Variables                                                         //
String CurrentPage;                                                      //
                                                                         //
// raccordement et selection borne pour bus ondrive                      //                                                                         //
#define ONE_WIRE_BUS 14                                                  // entre 14 sur la carte pour les sondes
OneWire oneWire(ONE_WIRE_BUS);                                           //
                                                                         //
// oneWire reference to Dallas Temperature.                              //
DallasTemperature sensors(&oneWire);                                     // 
                                                                         //
                                                                         //
// Adrese sonde DS18B20s //                                              // supprimer les adresse non utilisé         
DeviceAddress S4={0x28, 0x0D, 0x8D, 0x11, 0x28, 0x19, 0x01, 0x75};       // adresse sonde 4  chaudiere bois
DeviceAddress S12={0x28, 0x55, 0x90, 0xA9, 0x27, 0x19, 0x01, 0xB8};      // adresse sonde 12 haut ballon tampon
DeviceAddress S14={0x28, 0x90, 0xD6, 0x07, 0xD6, 0x01, 0x3C, 0xFA};      // adresse sonde 14 bas ballon tampon
DeviceAddress S16={0x28, 0x53, 0xE3, 0x07, 0xD6, 0x01, 0x3C, 0x6A};      // adresse sonde 16 bas ECS
                                                                         //
// Menue affichage (thermostat)                                          //
void termostat()  {                                                      //
                                                                         //
 CurrentPage     =  "termostat";                                         // nom de la page
 tft.setTextColor(BLACK);                                                // couleur de texte noir
 tft.setTextSize(3);                                                     // taille de texte 3
 tft.fillRect(0, 0, 500, 350, BLACK);                                    // carré noir qui prend toute  l'écran  
 tft.fillCircle(210, 170, 60, GREY);                                     // cercle gris
 tft.drawCircle(210,170, 60, WHITE);                                     // contoure de cercle blanc
 tft.setTextColor(WHITE);                                                // couleur texte blanc
 tft.setCursor(80, 20);                                                  // emplacement texte
 tft.print("THERMOSTAT ECS");                                            // texte thermostat
                                                                         //
 // bouton -                                                             // indication
 tft.setTextSize(4);                                                     // taille de texte 4
 tft.setTextColor(GREEN);                                                //
 tft.drawCircle(120, 120, 45, GREY);                                     // contour du bouton vert
 tft.setCursor(110, 110);                                                // position du texte
 tft.print("-");                                                         // texte -
                                                                         //
 // bouton +                                                             // indication
 tft.setTextColor(RED);                                                  //
 tft.drawCircle(300, 220, 45, GREY);                                     // contour bouton rouge
 tft.setCursor(290, 210);                                                // position du texte
 tft.print("+");                                                         // texte +
                                                                         //
 //bar menu du bas                                                       // indication
 tft.drawRect(305, 270, 170, 40, GREY);                                  // rectangle rouge
 tft.setTextSize(3);                                                     // taille de texte 3
 tft.setTextColor(WHITE);                                                // couleur de texte blanc
 tft.setCursor(345, 280);                                                // emplacement du texte
 tft.println("SECU");                                                    // texte INFO
 tft.drawRect(0, 270, 170, 40, GREY);                                    // rectangle rouge
 tft.setCursor(10, 280);                                                 // emplacement du texte
 tft.println("TAMPON");                                                  // texte tampon
 }                                                                       // fin 
                                                                         //
void acceuil()  {                                                        //
                                                                         //
// affichage page d'acceuil                                              //
 CurrentPage     =  "acceuil";                                           // nom de la page
  tft.fillRect(0, 0, 500, 350, BLACK);                                   // carré noir qui prend toute  l'écran 
  tft.setTextSize(3);                                                    // taille du texte 3
  tft.setTextColor(WHITE);                                               // couleur du texte blanc
  tft.setCursor(25, 20);                                                 // positionement du texte 
  tft.println("TEMPERATURE CHAUDIERE s4");                               // texte temperature eau radiateur
}                                                                        // fin
                                                                         //
void  info()  {                                                          // menue ECS
// affichage menue info                                                  //
    CurrentPage     =  "info";                                           // nom de la page
    tft.fillRect(0, 0, 500, 350, BLACK);                                 // carré noir qui prend toute  l'écran 
    tft.setTextColor(GREY);                                              // couleur du texte bleu claire
    tft.setTextSize(4);                                                  // taille du texte 3
    tft.setCursor(200, 10);                                              // position du texte
    tft.print("SECU");                                                   // texte ecs
   // bouton - 1                                                            // indication
 tft.setTextSize(4);                                                     // taille de texte 4
 tft.setTextColor(GREEN);                                                //
 tft.drawCircle(50, 80, 30, GREY);                                     // contour du bouton vert
 tft.setCursor(40, 70);                                                // position du texte
 tft.print("-");                                                         // texte -
                                                                         //
 // bouton +  1                                                           // indication
 tft.setTextColor(RED);                                                  //
 tft.drawCircle(150, 80, 30, GREY);                                     // contour bouton rouge
 tft.setCursor(140, 140);                                                // position du texte
 tft.print("+");                                                         // texte +
 // bouton - 2                                                            // indication
 tft.setTextSize(4);                                                     // taille de texte 4
 tft.setTextColor(GREEN);                                                //
 tft.drawCircle(50, 150, 30, GREY);                                     // contour du bouton vert
 tft.setCursor(40, 140);                                                // position du texte
 tft.print("-");                                                         // texte -                                                                         //
 // bouton +  2                                                           // indication
 tft.setTextColor(RED);                                                  //
 tft.drawCircle(150, 150, 30, GREY);                                     // contour bouton rouge
 tft.setCursor(140, 70);                                                // position du texte
 tft.print("+");                                                         // texte +
// bouton - 3                                                            // indication
 tft.setTextSize(4);                                                     // taille de texte 4
 tft.setTextColor(GREEN);                                                //
 tft.drawCircle(50, 220, 30, GREY);                                     // contour du bouton vert
 tft.setCursor(40, 210);                                                // position du texte
 tft.print("-");                                                         // texte -                                                                         //
 // bouton +  3                                                           // indication
 tft.setTextColor(RED);                                                  //
 tft.drawCircle(150, 220, 30, GREY);                                     // contour bouton rouge
 tft.setCursor(140, 210);                                                // position du texte
 tft.print("+");                                                         // texte +
 
 tft.fillCircle(250, 80, 30, GREY);                                     // cercle gris
 tft.fillCircle(250, 150, 30, GREY);                                     // cercle gris
 tft.fillCircle(250, 220, 30, GREY);                                     // cercle gris
 
 tft.setTextColor(GREY);                                              // couleur du texte bleu claire
 tft.setTextSize(3);                                                  // taille du texte 3
 tft.setCursor(300, 70);                                              // position du texte
 tft.print("Dif bois");                                                   // texte ecs
 tft.setCursor(300, 140);                                              // position du texte
 tft.print("Dif ECS");                                                   // texte ecs
 tft.setCursor(300, 210);                                              // position du texte
 tft.print("T secu");                                                   // texte ecs
 
 tft.drawRect(180, 270, 170, 40, GREY);                                  // rectangle rouge
 tft.setTextSize(3);                                                     // taille de texte 3
 tft.setTextColor(WHITE);                                                // couleur de texte blanc
 tft.setCursor(185, 280);                                                // emplacement du texte
 tft.println("RETOUR");                                                    // texte INFO
}                                                                        // fin  
void  tampon()  {                                                        // Menue Tampon
                                                                         //
    CurrentPage     =  "tampon";                                         // Nom de la page
    tft.fillRect(0, 0, 500, 350, BLACK);                                 // grrand carree noire
    tft.setTextColor(GREY);                                              // couleur texte gris
    tft.setTextSize(2);                                                  // taille du texte 3
    tft.setCursor(220, 10);                                              // position du texte
    tft.print("Vers radiateur");                                         // texte
    tft.fillCircle(150, 130, 48, BLUE);                                  // partie haute du ballon
    tft.fillCircle(150, 270, 48, BLUE);                                  // partie basse du ballon
    tft.fillRect(102, 130, 98, 143, BLUE);                               // corps du ballon
    tft.fillCircle(420, 130, 48, BLUE);                                  // partie haute du ballon
    tft.fillCircle(420, 270, 48, BLUE);                                  // partie basse du ballon
    tft.fillRect(372, 130, 98, 143, BLUE);                               // corps du ballon
    tft.fillRect(50, 60, 245, 5, RED);                                   // Bar horisontal by Pass
    tft.fillRect(50, 60, 5, 45, RED);                                    // Bar vertical by passe 
    tft.fillRect(1, 100, 110,5, RED);                                    // Bar horisontal pompe bois                              
    tft.fillRect(200, 150, 30, 5, RED);                                  // Bar horisontal vers vanne 3 voie
    tft.fillRect(200, 120, 170, 5, RED);                                 // Bar horisontal vers ECS
    tft.fillRect(1, 250, 100, 5, BLUE);                                  // Bar horisontal retour coté chaudiere
    tft.fillRect(200, 250, 120, 5, BLUE);                                // Bar horisontal retour ballon cote radiateur
    tft.fillRect(200, 270, 170, 5, BLUE);                                // Bar horisontal retour ballon ECS
    tft.fillRect(320, 40, 5, 215, BLUE);                                 // Bar vertical retour cote radiateur
    tft.fillRect(240, 150, 60, 5, RED);                                  // Bar horisontal vers radiateur
    tft.fillRect(295, 40, 5, 110, RED);                                  // Bar vertical vers radiateur
    tft.setCursor(5, 120);                                               // position texte
    tft.print("Pompe B");                                                // texte
    tft.setCursor(50, 40);                                               // position texte
    tft.print("By passe");                                               // texte
    tft.setCursor(5, 230);                                               // position texte
    tft.print("Retour");                                                 // texte
    tft.setCursor(340, 80);                                              // position texte
    tft.print("ECS");                                                    // texte
    tft.setTextSize(1);                                                  // taille du texte
    tft.setCursor(125, 110);                                             // position texte
    tft.print("T haute s12");                                            // texte
    tft.setCursor(125, 230);                                             // position texte
    tft.print("T Bas s14");                                              // texte
    tft.setCursor(395, 150);                                             // position texte
    tft.print("T ECS s16");                                              // texte
}                                                                        // fin
                                                                         //
void setup() {                                                           //
 while(!Serial);                                                         //
     pinMode(26, OUTPUT);                                                // sortie k0 pompe bois
     pinMode(27, OUTPUT);                                                // sortie k1 pompe radiateur
     pinMode(28, OUTPUT);                                                // sortie k2 pompe ECS
     pinMode(29, OUTPUT);                                                // sortie k3 BY Pass
                                                                         //
  Serial.begin(115200);                                                  // vitesse ce comunication
  tempV1 = EEPROM.read (3);                                              // memoire 1
  tempV2 = EEPROM.read (4);                                              // memoire 2
  tempV3 = EEPROM.read (5);                                              // memoire 3
  tempV4 = EEPROM.read (6);                                              // memoire 4
  tft.reset();                                                           // reset ecran
  ID = tft.readID();                                                     // type d'écran
  tft.begin(ID);                                                         // type d'écran
  tft.setRotation(LCDROTATION);                                          // Need for the Mega, please changed for your choice or rotation initial
                                                                         //
  tampon();                                                             //
}                                                                        //
                                                                         //
void loop() {                                                            //
  unsigned long currentMillis = millis();                                //
  sensors.requestTemperatures();                                         // lecture des sonde  
  //float Tc =(tempV1-(sensors.getTempC(S8)-20)*10);                     // calcule de loie d'eau 10 deg. de moins départ pour 1deg de plus int
 
  float Tc =tempV1;                                                      //
   float Secu = tempV2;                                                       //
  float Tecs = (sensors.getTempC(S16)+tempV3);                               // calcule temp. ECS
  float Tbois = (sensors.getTempC(S14)+tempV4);                              // calcule temp. bois
                                                                         //
  boolean K0=digitalRead(26);                                            //pompe bois 
  boolean K1=digitalRead(27);                                            //pompe radiateur
  boolean K2=digitalRead(28);                                            //Pompe ECS
  boolean K3=digitalRead(29);                                            //By passe
                                                                         //
 Touch();                                                                //
                                                                         //
 if  (CurrentPage == "termostat") {                                      //
 if (currentMillis > previousMillisPaf + tempo2) {                       //
    previousMillisPaf = currentMillis;                                   //
    tft.setTextColor(BLACK, GREY);                                       // couleur texte
    tft.setTextSize(4);                                                  // taille de taxte
    tft.setCursor(185, 155);                                             // emplacement texte
    tft.print(tempV1);                                                   // temporisation non blocante
    tft.setTextColor(WHITE, BLACK);                                      // couleur texte
    tft.setTextSize(2);                                                  // taille de texte
    tft.setCursor(5, 245);                                               //
}}                                                                       //
                                                                         //
 if  (CurrentPage == "acceuil") {                                        //
   tft.setTextColor(WHITE, BLACK);                                       // couleur du texte 
   tft.setTextSize(10);                                                  // taille du texte
                                                                         //
 if (currentMillis > previousMillisPaf + tempo2) {                       //
    previousMillisPaf = currentMillis;                                   //
    tft.setCursor(50, 70);                                               // position du texte
    tft.println(sensors.getTempC(S4));                                   // sonde temperature ECS
    tft.setCursor(400, 70);                                              // position du texte 
    tft.println("C");                                                    // texte C
                                                                         //
    tft.drawCircle(250,230, 65, GREY);                                   // contoure de cercle orang
    tft.drawCircle(250,230, 55, GREY);                                   // contoure de cercle orange
    tft.drawCircle(250,230, 45, GREY);                                   // contoure de cercle orange
    tft.drawCircle(250,230, 35, GREY);                                   // contoure de cercle orange
    tft.drawCircle(250,230, 25, GREY);                                   // contoure de cercle orange
    tft.drawCircle(250,230, 15, GREY);                                   // contoure de cercle orange
    tft.drawCircle(250,230, 65, BLACK);                                  // contoure de cercle orange
    tft.drawCircle(250,230, 55, BLACK);                                  // contoure de cercle orange
    tft.drawCircle(250,230, 45, BLACK);                                  // contoure de cercle orange
    tft.drawCircle(250,230, 35, BLACK);                                  // contoure de cercle orange
    tft.drawCircle(250,230, 25, BLACK);                                  // contoure de cercle orange
    }}                                                                   // fin
                                                                         //
 if  (CurrentPage == "info") {                                           //
  tft.setTextColor(WHITE);                                               //
 if (currentMillis > previousMillisPaf + tempo2) {                       //
    previousMillisPaf = currentMillis;                                   //
  tft.setTextColor(BLACK, GREY);                                         // couleur du texte bleu claire
  tft.setCursor(235, 70);                                                // position du texte
  tft.print(tempV4);                                                   // temporisation non blocante
  tft.setCursor(235, 140);                                                // position du texte
  tft.print(tempV3);                                                   // temporisation non blocante
  tft.setCursor(235, 210);                                                // position du texte
  tft.print(tempV2);                                                   // temporisation non blocante
 }}                                                                      //
                                                                         //
 if  (CurrentPage == "tampon") {                                         //
  tft.setTextColor(WHITE, BLACK);                                               //
  tft.setTextSize(2);                                                    //
   if (currentMillis > previousMillisPaf + tempo2) {                     //
    previousMillisPaf = currentMillis;                                   //
  tft.setCursor(10, 10);
  tft.print(" bois");
  tft.setCursor(100,10);                                                // affichage position
  tft.println(sensors.getTempC(S4));                                    // affichage sonde ECS Bas                                                                        //
  tft.setTextColor(WHITE, BLUE);                                         // taille de texte
  tft.setCursor(125,125);                                                // affichage position
  tft.println(sensors.getTempC(S12));                                    // affichage sonde TAMPON haute
  tft.setCursor(125,255);                                                // affichage position
  tft.println(sensors.getTempC(S14));                                    // affichage sonde TAMPON Bas
  tft.setCursor(390,170);                                                // affichage position
  tft.println(sensors.getTempC(S16));                                    // affichage sonde ECS Bas
 
    if (K0==0)                                                           // si état relais en marche
    {tft.fillCircle(20,100,15,GREEN);}                                   // POMPE CHAUDIERE
    else                                                                 // sinon
    {tft.fillCircle(20,100,15, RED);}                                    // POMPE CHAUDIERE
    if (K3==0)                                                           // si état relais en marche
    {tft.fillCircle(170,63,15,GREEN);}                                   // BY PASSE
    else                                                                 // sinon
    {tft.fillCircle(170,63,15,RED);}                                     // BY PASSE
    if (K1==0)                                                           // si état relais en marche
    {tft.fillCircle(233,150,15,GREEN);}                                  // POMPE CHAUFFAHE
    else                                                                 // sinon
    {tft.fillCircle(233,150,15,RED);}                                    // POMPE CHAUFFAGE
     if (K2==0)                                                          // si état relais en marche
    {tft.fillCircle(350,120,15,GREEN);}                                  // POMPE ECS
    else                                                                 // sinon
    {tft.fillCircle(350,120,15,RED);}                                    // POMPE ECS
 }}                                                                      //
                                                                         //
   /// fonction sortie ///                                               // fonction des sortie 
     // pompe radiateur //                                               // fonction pompe radiateur
                                                                         //
   if(sensors.getTempC(S12)>(40))                                        // si haut tampon superrieur a 35
  {digitalWrite(27,LOW);}                                                // on alume la pompe bois 
   if(sensors.getTempC(S12)<(30))                                        // si haut tampon superrieur a 35
  {digitalWrite(27,HIGH);}                                               // on arret la pompe bois
  if (K1==1)                                                             // si pompe radiateur en arreter
  {digitalWrite(29, LOW);}                                               // on active le by passe
  else                                                                   // sinon
  {digitalWrite(29, HIGH);}                                              // on desactive le by passe
                                                                         //
  /// pompe chaudiere bois///                                            // fonction pompe chauffage bois 
                                                                         //
  if(sensors.getTempC(S4)>(Secu))                                          // si la chaudière et supperieur a 80 degré
  {digitalWrite(26,LOW);}                                                // on active le circulateur
  else                                                                   // sionon 
  {if(sensors.getTempC(S4)>(60))                                         // si temperatute départ bois superieur a 60
  {if(sensors.getTempC(S4)>(Tbois))                                      // si temperature chaudière bois superieur de 15 degre
  {digitalWrite(26,LOW);}                                                // on alume la pompe bois                                      
   else                                                                  // sinon
  {digitalWrite(26,HIGH);}}                                              // on arret la pompe bois
  else                                                                   // sinon
  {digitalWrite(26,HIGH);}}                                              // on arret la pompe bois
                                                                         //
   /// eau chaude sanitaire ///                                          // fonction ECS
                                                                         //
   if(sensors.getTempC(S4)>(Secu))                                         //si ballon tampon superieur à 80 degré
   {digitalWrite(28,LOW);}                                               //on active la pompe ecs   
    else                                                                 //sionon
  {if((sensors.getTempC(S12)>(Tecs))&&(sensors.getTempC(S16)<(Tc)))      // si temperature tampon haut superieur de 10 degre de ECS
  {digitalWrite(28,LOW);}                                                // marche pompe ECS
   else                                                                  // sinon
  {digitalWrite(28,HIGH);}}                                              // arret pompe ECS
  }                                                                      //
                                                                         //
void  Touch() {                                                          //
                                                                         //
  TSPoint p = ts.getPoint();                                             //
                                                                         //
  pinMode(XM, OUTPUT);                                                   //
  pinMode(YP, OUTPUT);                                                   //
                                                                         //
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {                          // minimum pressure we consider 'valid' - pressure of 0 means no pressing!
                                                                         //
    // scale from 0->1023 to tft.width                                   //
    p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);                    //
    p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);                   //
                                                                         //
    /*  Display Touch coordinates and pressure to the Serial console  */ //
    Serial.print("p.x = ");                                              //
    Serial.print(p.x);                                                   //
    Serial.print("  |  p.y = ");                                         //
    Serial.print(p.y);                                                   //
    Serial.print("  |  Pressure = ");                                    //
    Serial.println(p.z);                                                 //
      if  (CurrentPage == "acceuil")                                     //
        {termostat();}                                                   //
      if  (CurrentPage == "tampon")                                      //
        {acceuil();}                                                     //
    //  if  (CurrentPage == "info")                                        //
    //    {acceuil();}                                                     //
                                                                         //
       //bouton suivant                                                  //
    if (p.y > 220 && p.y < 330 && p.x > 440 && p.x < 500) {              //
                                                                         //
      if  (CurrentPage == "termostat")                                   //
       {info();}}                                                        //
                                                                         //
       //bouton precedent                                                //
    if (p.y > 0 && p.y < 110 && p.x > 440 && p.x < 500) {                //
      if (CurrentPage == "termostat")                                    //
      {tampon();}}                                                       //
                                                                         //
    //  bouton +                                                         //
    if  (CurrentPage == "termostat")                                     //
    {                                                                    //
                                                                         //
    }                                                                    //
    if (p.y > 180 && p.y < 240 && p.x > 280 && p.x < 420) {              //
                                                                         //
      if  (CurrentPage == "termostat") {                                 //
        tempV1++;                                                        //
        EEPROM.write (3, tempV1);                                        //
      }}                                                                 //
                                                                         //
    //  Button -                                                         //
    if (p.y > 50 && p.y < 180 && p.x > 130 && p.x < 250) {               //
                                                                         //
      if  (CurrentPage == "termostat") {                                 //
        tempV1--;                                                        //
        EEPROM.write (3, tempV1);                                        //
      }}
 
 
      // dif bois
     if (p.y > 60 && p.y < 130 && p.x > 90 && p.x <170) {              //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV4++;                                                        //
        EEPROM.write (6, tempV4);                                        //
      }}                                                                 //
                                                                         //
    //  Button -                                                         //
    if (p.y > 0 && p.y < 60 && p.x > 90 && p.x < 170) {               //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV4--;                                                        //
        EEPROM.write (6, tempV4);                                        //
      }}
 
       // dif ECS
     if (p.y > 60 && p.y < 130 && p.x > 200 && p.x <290) {              //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV3++;                                                        //
        EEPROM.write (5, tempV3);                                        //
      }}                                                                 //
                                                                         //
    //  Button -                                                         //
    if (p.y > 0 && p.y < 60 && p.x > 180 && p.x < 290) {               //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV3--;                                                        //
        EEPROM.write (5, tempV3);                                        //
      }} 
 
       // secu
     if (p.y > 60 && p.y < 130 && p.x > 300 && p.x <400) {              //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV2++;                                                        //
        EEPROM.write (4, tempV2);                                        //
      }}                                                                 //
                                                                         //
    //  Button -                                                         //
    if (p.y > 0 && p.y < 60 && p.x > 300 && p.x < 400) {               //
                                                                         //
      if  (CurrentPage == "info") {                                 //
        tempV2--;                                                        //
        EEPROM.write (4, tempV2);                                        //
      }} 
 
 
  if (p.y > 120 && p.y < 200 && p.x > 440 && p.x < 500) {              //                                                                  //
      if  (CurrentPage == "info")                                   //
       {acceuil();}}                                                        //     
 
      }}
merci si une personne a une réponse à mon problème