Bonjour, je suis étudiant en BTS SN et pour mon projet je dois réaliser un didacticiel à partir d'un Arduino Mega 2560, de 3 boutons poussoir et d'un afficheur graphique TFT2.8".

J'ai déjà réalisé le code sauf que mes messages (mes println) se superposent sur l'écran et mes boutons ne font pas changer mes pages.

Je vous mets le code afin que vous compreniez plus en détail ma demande:
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
#define DEBUG
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
 
 
#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
 
 
 
// Couleurs d'écriture et de fond possible
#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF
 
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
 
#define initial 0
#define client 1
#define page11 2
#define page12 3
#define page13 4
#define page14 5
#define page21 6
#define page22 7
#define page23 8
#define page24 9
#define technicien 10
#define page31 11
#define page32 12
#define page33 13
#define page34 14
#define page41 15
#define page42 16
#define page43 17
#define page44 18
 
const int boutonp = 35 ;
const int boutonm = 37 ;
const int boutonok = 39 ;
 
int etat=0;
 
unsigned long envoiMessage(char*texte);
 
#define DEBUG 1
void setup(void) {
 #ifdef DEBUG
  Serial.begin(9600);
  Serial.println(F("TFT LCD test"));
  Serial.print("TFT size is ");
  Serial.print(tft.width());
  Serial.print("x");
  Serial.println(tft.height());
#endif // DEBUG
  tft.reset();
 
pinMode(boutonp, INPUT);
pinMode(boutonm, INPUT);
pinMode(boutonok, INPUT);
 
#ifdef DEBUG
  uint16_t identifier = tft.readID();
 
  switch (identifier)
  {
    case 0x9325:    Serial.println(F("Found ILI9325 LCD driver")); break;
 
    case 0x9328:    Serial.println(F("Found ILI9328 LCD driver")); break;
 
    case 0x7575:    Serial.println(F("Found HX8347G LCD driver")); break;
 
    case 0x9341:    Serial.println(F("Found ILI9341 LCD driver")); break;
 
    case 0x8357:    Serial.println(F("Found HX8357D LCD driver")); break;
 
    default    :    Serial.print(F("Unknown LCD driver chip: "));
 
 
                      Serial.println(identifier, HEX);
                      Serial.print(F("I try use ILI9341 LCD driver "));
                      Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
                      Serial.println(F("  #define USE_ADAFRUIT_SHIELD_PINOUT"));
                      Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
                      Serial.println(F("If using the breakout board, it should NOT be #defined!"));
                      Serial.println(F("Also if using the breakout, double-check that all wiring"));
                      Serial.println(F("matches the tutorial."));
#endif // DEBUG
    identifier = 0x9341;
    break;
  } // fin switch
 
 
 
 
 
                      tft.begin(identifier);
                      tft.setRotation(3);
                      tft.setTextColor(WHITE);
                      tft.setTextSize(3);
                      tft.fillScreen(BLACK);
 
 
#ifdef DEBUG
 
 
                     Serial.print(F("Fin Setup                     "));
 
 
 
#endif // DEBUG
 
 
}//fin setup
 
 
void loop(void) 
 
 {
   switch(etat)
   {
        case initial:
         tft.println("Initial");
        if (boutonp) etat=client;
        if (boutonm) etat=technicien;
        break;
 
        case client:
         tft.println("Client");
        if (boutonp) etat=page11;
        if (boutonm) etat=page21;
        if (boutonok) etat=initial;
        break;
 
        case technicien:
         tft.println("technicien");
        if (boutonp) etat=page31;
        if (boutonm) etat=page41;
        if (boutonok) etat=initial;
        break;
 
        case page11:
        tft.println("11");
        if (boutonp) etat=page12;
        if (boutonm) etat=client;
        if (boutonok) etat=initial;
        break;
 
        case page12:
        tft.println("12");
        if (boutonp) etat=page13;
        if (boutonm) etat=page11;
        if (boutonok) etat=initial;
        break;
 
         case page13:
         tft.println("13");
        if (boutonp) etat=page14;
        if (boutonm) etat=page12;
        if (boutonok) etat=initial;
        break;
 
         case page14:
         tft.println("14");
        if (boutonp) etat=initial;
        if (boutonm) etat=page13;
        if (boutonok) etat=initial;
        break;
 
         case page21:
         tft.println("21");
        if (boutonp) etat=page22;
        if (boutonm) etat=client;
        if (boutonok) etat=initial;
        break;
 
         case page22:
         tft.println("22");
        if (boutonp) etat=page23;
        if (boutonm) etat=page21;
        if (boutonok) etat=initial;
        break;
 
         case page23:
         tft.println("23");
        if (boutonp) etat=page24;
        if (boutonm) etat=page22;
        if (boutonok) etat=initial;
        break;
 
         case page24:
         tft.println("24");
        if (boutonp) etat=initial;
        if (boutonm) etat=page23;
        if (boutonok) etat=initial;
        break;
 
        case page31:
         tft.println("31");
        if (boutonp) etat=page32;
        if (boutonm) etat=technicien;
        if (boutonok) etat=initial;
        break;
 
         case page32:
         tft.println("32");
        if (boutonp) etat=page33;
        if (boutonm) etat=page31;
        if (boutonok) etat=initial;
        break;
 
         case page33:
         tft.println("33");
        if (boutonp) etat=page34;
        if (boutonm) etat=page32;
        if (boutonok) etat=initial;
        break;
 
         case page34:
         tft.println("34");
        if (boutonp) etat=initial;
        if (boutonm) etat=page33;
        if (boutonok) etat=initial;
        break;
 
         case page41:
         tft.println("41");
        if (boutonp) etat=page42;
        if (boutonm) etat=technicien;
        if (boutonok) etat=initial;
        break;
 
         case page42:
         tft.println("42");
        if (boutonp) etat=page43;
        if (boutonm) etat=page41;
        if (boutonok) etat=initial;
        break;
 
         case page43:
         tft.println("43");
        if (boutonp) etat=page44;
        if (boutonm) etat=page42;
        if (boutonok) etat=initial;
        break;
 
         case page44:
         tft.println("44");
        if (boutonp) etat=initial;
        if (boutonm) etat=page43;
        if (boutonok) etat=initial;
        break;
 
        default:
        tft.println ("Erreur");
      break;
    }
tft.setCursor(0, 0);
}//fin loop
 
 
unsigned long envoiMessage(char*texte) 
{
 
  unsigned long start = micros();
 
 
  tft.println(texte);
 
  return micros() - start;
}//fin envoimessage

Nom : IMG_2577.JPG
Affichages : 472
Taille : 82,1 Ko

Si vous avez des solutions à m'apporter ou des questions plus précise, ça serait sympa.

Merci à bientôt.
Screampy57