IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Arduino Discussion :

Problème d'affichage et de switch


Sujet :

Arduino

  1. #1
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut Problème d'affichage et de switch
    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 : 425
Taille : 82,1 Ko

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

    Merci à bientôt.
    Screampy57

  2. #2
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Bonsoir Screampy57

    A première vue. et sans aller dans l'analyse complète de ton code, la ligne de code
    est responsable de l'écriture superposée de tes messages.
    Soit on écrit en dessous, soit on doit effacer l'écran auparavant.

    Pour les boutons, je ne comprends pas! Mais bon si les messages se superposent, c'est que tu va bien dans les différents états, au moins certains (c'est ça que tu appelles les page )

    Bonne soirée

    Delias

  3. #3
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut
    J'ai modifié mon set cursor et en fait il faut que je fasse des pages (quand j'appuye sur le + ça passe à une autre page etc)
    comme ceci :

    Nom : Capture.PNG
Affichages : 378
Taille : 76,0 Ko

    actuellement mon code modifié est comme ça:

    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
     
    //#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,BLACK);
                          tft.setTextSize(3);
     
     
     
    #ifdef DEBUG
     
     
                         Serial.print(F("Fin Setup                     "));
     
     
     
    #endif // DEBUG
     
     
    }//fin setup
     
     
    void loop(void) 
     
     {
       switch(etat)
       {
            case initial:
             tft.println("Initial");
            if (digitalRead(boutonp)) etat=client;
            if (digitalRead(boutonm)) etat=technicien;
            break;
     
            case client:
             tft.println("Client");
            if (digitalRead(boutonp)) etat=page11;
            if (digitalRead(boutonm)) etat=page21;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
            case technicien:
             tft.println("technicien");
            if (digitalRead(boutonp)) etat=page31;
            if (digitalRead(boutonm)) etat=page41;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
            case page11:
            tft.println("11");
            if (digitalRead(boutonp)) etat=page12;
            if (digitalRead(boutonm)) etat=client;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
            case page12:
            tft.println("12");
            if (digitalRead(boutonp)) etat=page13;
            if (digitalRead(boutonm)) etat=page11;
            if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page13:
             tft.println("13");
            if (digitalRead(boutonp)) etat=page14;
            if (digitalRead(boutonm)) etat=page12;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page14:
             tft.println("14");
            if (digitalRead(boutonp)) etat=initial;
            if (digitalRead(boutonm)) etat=page13;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page21:
             tft.println("21");
            if (digitalRead(boutonp)) etat=page22;
            if (digitalRead(boutonm)) etat=client;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page22:
             tft.println("22");
            if (digitalRead(boutonp)) etat=page23;
            if (digitalRead(boutonm)) etat=page21;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page23:
             tft.println("23");
            if (digitalRead(boutonp)) etat=page24;
            if (digitalRead(boutonm)) etat=page22;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page24:
             tft.println("24");
            if (digitalRead(boutonp)) etat=initial;
            if (digitalRead(boutonm)) etat=page23;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
            case page31:
             tft.println("31");
            if (digitalRead(boutonp)) etat=page32;
            if (digitalRead(boutonm)) etat=technicien;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page32:
             tft.println("32");
            if (digitalRead(boutonp)) etat=page33;
            if (digitalRead(boutonm)) etat=page31;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page33:
             tft.println("33");
           if (digitalRead(boutonp)) etat=page34;
            if (digitalRead(boutonm)) etat=page32;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page34:
             tft.println("34");
            if (digitalRead(boutonp)) etat=initial;
            if (digitalRead(boutonm)) etat=page33;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page41:
             tft.println("41");
            if (digitalRead(boutonp)) etat=page42;
            if (digitalRead(boutonm)) etat=technicien;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page42:
             tft.println("42");
            if (digitalRead(boutonp)) etat=page43;
            if (digitalRead(boutonm)) etat=page41;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page43:
             tft.println("43");
            if (digitalRead(boutonp)) etat=page44;
            if (digitalRead(boutonm)) etat=page42;
             if (digitalRead(boutonok)) etat=initial;
            break;
     
             case page44:
             tft.println("44");
            if (digitalRead(boutonp)) etat=initial;
            if (digitalRead(boutonm)) etat=page43;
            if (digitalRead(boutonok)) etat=initial;
            break;
     
            default:
            tft.println ("Erreur");
          break;
        }
            tft.setCursor(0, 0);
            tft.println("                    ");//efface l'ancien message
            tft.setCursor(0, 0);
     
    delay(1000);
    }//fin loop
     
     
    unsigned long envoiMessage(char*texte) 
    {
     
      unsigned long start = micros();
     
     
      tft.println(texte);
     
      return micros() - start;
    }//fin envoimessage

  4. #4
    Responsable Arduino et Systèmes Embarqués


    Avatar de f-leb
    Homme Profil pro
    Enseignant
    Inscrit en
    Janvier 2009
    Messages
    12 620
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Janvier 2009
    Messages : 12 620
    Points : 56 857
    Points
    56 857
    Billets dans le blog
    40
    Par défaut
    Bonsoir,

    Code c++ : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    const int boutonp = 35 ;
     
    ...
    pinMode(boutonp, INPUT);
     
    ...
     
    if (boutonp) ...

    Je pense que tu confonds le numéro de la broche où est connecté le bouton, et son état (HIGH ou LOW). Il faut lire l'état de la broche (fonction digitalRead).

  5. #5
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut
    Je ne sais pas du tout ... :/ avez vous des solutions ?

  6. #6
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Rebonsoir

    Ton 2ème code est bien mieux!
    Par contre tu devrais réfléchir un peu au timing de ton code:
    - Il effectue la lecture des boutons 1x toutes les secondes (environ!) Si on presse brièvement entre deux, il n'y a pas de lecture.
    - L'état est modifié à la suite de cette lecture, mais l'état n'est indiqué sur l'écran qu'à la seconde suivante, et si l'utilisateur re-presse à ce moment (car il pense que le précédent n'est pas passé), il effectue une commande en trop.
    Il devrait y avoir une lecture continue, un affichage en direct puis une attente de 1sec (c'est une bonne valeur au début) avant de prendre en compte un nouvel appuis sur la même touche.

    Pour l'affichage, est-ce que avec les deux nouvelles lignes de code cela fonctionne? Car j'en suis pas certain, écrire des espaces, si les caractères ne recouvrent pas le texte précédent, il est fort possible que les espaces agissent de même et n'aient aucun effet.

    Par contre je suis incapable de trouver la doc des librairies utilisées pour l'écran, donc dans l'impossibilité de t'aider plus.

    Delias

  7. #7
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut
    Bonjour,

    Oui j'ai enlevé mon delay que je rajouterai à 300 par la suite.
    Pour ce qui est de l'afficheur, il récrie sur le texte précédent, pour mon switch il fonctionne mais mes boutons sont toujours à l'état 1.
    Sais tu comment les modifier ? et effacer mes messages précédent.

    Pour l'afficheur c'est l'afficheur TFT2,8" de chez Lextronic

    A+

  8. #8
    Responsable Arduino et Systèmes Embarqués


    Avatar de f-leb
    Homme Profil pro
    Enseignant
    Inscrit en
    Janvier 2009
    Messages
    12 620
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Janvier 2009
    Messages : 12 620
    Points : 56 857
    Points
    56 857
    Billets dans le blog
    40
    Par défaut
    Bonjour,

    Ce serait plus simple avec un schéma de câblage des boutons...

  9. #9
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Bonsoir

    Choisi dans chaque parenthèse la bonne réponse, cela devrait aider un peu:
    Les boutons sont équipés de pull (-up / -down), de ce fait le potentiel à l'entrée est (VCC / GND) quand le bouton est relâché et (VCC / GND) quand le bouton est pressé. VCC correspond à l'état (HIGH, TRUE / LOW, FALSE) alors que GND correspond à l'état (HIGH, TRUE / LOW, FALSE).

    Bonne soirée

    Delias

  10. #10
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut
    REBONSOIR,

    Pour ce qui est des boutons et de leurs état tout est ok maintenant les seuls problèmes que j'ai sont que mes textes que j'affiche se redémarrent en boucle et mon écriture ne prend pas tous l'écran, un autre problème, mes boutons réagissent un peu tardivement.

    Voici une image du tout :
    Nom : IMG_2580.JPG
Affichages : 371
Taille : 91,1 Ko

    et voici mon code :

    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
    //#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,BLACK);
                          tft.setTextSize(3);
     
     
     
     
    #ifdef DEBUG
     
     
                         Serial.print(F("Fin Setup                     "));
     
     
     
    #endif // DEBUG
     
     
    }//fin setup
     
     
    void loop(void) 
     
     {
     
     
            tft.setCursor(0, 0);
            tft.println("                    ");//efface l'ancien message
            tft.setCursor(0, 0);
     
       switch(etat)
       {
            case initial:
            tft.println("Initial");
            if (!digitalRead(boutonp)) etat=client;
            if (!digitalRead(boutonm)) etat=technicien;
            break;
     
            case client:
             tft.println("Client");
            if (!digitalRead(boutonp)) etat=page11;
            if (!digitalRead(boutonm)) etat=page21;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case technicien:
             tft.println("technicien");
            if (!digitalRead(boutonp)) etat=page31;
            if (!digitalRead(boutonm)) etat=page41;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page11:
            tft.println("11");
            if (!digitalRead(boutonp)) etat=page12;
            if (!digitalRead(boutonm)) etat=client;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page12:
            tft.println("12");
            if (!digitalRead(boutonp)) etat=page13;
            if (!digitalRead(boutonm)) etat=page11;
            if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page13:
             tft.println("13");
            if (!digitalRead(boutonp)) etat=page14;
            if (!digitalRead(boutonm)) etat=page12;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page14:
             tft.println("14");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page13;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page21:
             tft.println("21");
            if (!digitalRead(boutonp)) etat=page22;
            if (!digitalRead(boutonm)) etat=client;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page22:
             tft.println("22");
            if (!digitalRead(boutonp)) etat=page23;
            if (!digitalRead(boutonm)) etat=page21;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page23:
             tft.println("23");
            if (!digitalRead(boutonp)) etat=page24;
            if (!digitalRead(boutonm)) etat=page22;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page24:
             tft.println("24");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page23;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page31:
             tft.println("31");
            if (!digitalRead(boutonp)) etat=page32;
            if (!digitalRead(boutonm)) etat=technicien;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page32:
             tft.println("32");
            if (!digitalRead(boutonp)) etat=page33;
            if (!digitalRead(boutonm)) etat=page31;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page33:
             tft.println("33");
           if (!digitalRead(boutonp)) etat=page34;
            if (!digitalRead(boutonm)) etat=page32;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page34:
             tft.println("34");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page33;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page41:
             tft.println("41");
            if (!digitalRead(boutonp)) etat=page42;
            if (!digitalRead(boutonm)) etat=technicien;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page42:
             tft.println("42");
            if (!digitalRead(boutonp)) etat=page43;
            if (!digitalRead(boutonm)) etat=page41;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page43:
             tft.println("43");
            if (!digitalRead(boutonp)) etat=page44;
            if (!digitalRead(boutonm)) etat=page42;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page44:
             tft.println("44");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page43;
            if (!digitalRead(boutonok)) etat=initial;
            break;
     
            default:
            tft.println ("Erreur");
          break;
        }
     
     
     
    }//fin loop
     
     
    unsigned long envoiMessage(char*texte) 
    {
     
      unsigned long start = micros();
     
     
      tft.println(texte);
     
      return micros() - start;
    }//fin envoimessage

  11. #11
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Bonsoir

    Je t'ai déjà indiqué comment faire dans ma dernière réponse de hier.
    Il faudra complexifier un peu le code de la boucle. D'ailleurs je ne vois aucun delais dans ton dernier code, donc j'ai de la peine à voir d'où vient le fait:
    mes boutons réagissent un peu tardivement.
    Le problème d'affichage est probablement dû la succession trop rapide de l'écriture (dans le switch) et de l'effacement à la boucle suivante.

    Le problème initial était probablement dû à la succession rapide de plusieurs états, de ce fait, mon commentaire sur l'effacement n'est pas 100% correct. C'est toujours le problème de savoir si l'écriture est couvrante ou non.
    Il est probablement possible de s'en passer si toutes les écritures ont la même longueur.

    Bonne soirée

    Delias

  12. #12
    Candidat au Club
    Homme Profil pro
    BTS
    Inscrit en
    Mars 2017
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 26
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : BTS
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2017
    Messages : 6
    Points : 3
    Points
    3
    Par défaut
    Tout est résolu et j'ai mis un delay()

    Par contre je trouve qu' il faut vraiment appuyer franchement sur les boutons pour que ça change d'état est-ce que c'est normal ?

    Après j'ai encore une question mais peut être que tu me dira de crée un nouveau sujet, je souhaite mettre une photo dans mon texte comment faire ?

    MON CODE:
    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
    //#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,BLACK);
                          tft.setTextSize(3);
                           tft.fillScreen(BLACK);
     
     
     
     
    #ifdef DEBUG
     
     
                         Serial.print(F("Fin Setup                     "));
     
     
     
    #endif // DEBUG
     
     
    }//fin setup
     
     
    void loop(void) 
     
     {
     
     
            tft.setCursor(0, 0);
     
            tft.setCursor(0, 0);
    delay(300);
       switch(etat)
       {
            case initial:
            tft.println("Initial                     ");
            if (!digitalRead(boutonp)) etat=client;
            if (!digitalRead(boutonm)) etat=technicien;
            break;
     
            case client:
             tft.println("Client                     ");
            if (!digitalRead(boutonp)) etat=page11;
            if (!digitalRead(boutonm)) etat=page21;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case technicien:
             tft.println("technicien                  ");
            if (!digitalRead(boutonp)) etat=page31;
            if (!digitalRead(boutonm)) etat=page41;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page11:
            tft.println("11                           ");
            if (!digitalRead(boutonp)) etat=page12;
            if (!digitalRead(boutonm)) etat=client;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page12:
            tft.println("12                            ");
            if (!digitalRead(boutonp)) etat=page13;
            if (!digitalRead(boutonm)) etat=page11;
            if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page13:
             tft.println("13                           ");
            if (!digitalRead(boutonp)) etat=page14;
            if (!digitalRead(boutonm)) etat=page12;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page14:
             tft.println("14                           ");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page13;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page21:
             tft.println("21                           ");
            if (!digitalRead(boutonp)) etat=page22;
            if (!digitalRead(boutonm)) etat=client;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page22:
             tft.println("22                           ");
            if (!digitalRead(boutonp)) etat=page23;
            if (!digitalRead(boutonm)) etat=page21;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page23:
             tft.println("23                           ");
            if (!digitalRead(boutonp)) etat=page24;
            if (!digitalRead(boutonm)) etat=page22;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page24:
             tft.println("24                           ");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page23;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
            case page31:
             tft.println("31                            ");
            if (!digitalRead(boutonp)) etat=page32;
            if (!digitalRead(boutonm)) etat=technicien;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page32:
             tft.println("32                            ");
            if (!digitalRead(boutonp)) etat=page33;
            if (!digitalRead(boutonm)) etat=page31;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page33:
             tft.println("33                            ");
           if (!digitalRead(boutonp)) etat=page34;
            if (!digitalRead(boutonm)) etat=page32;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page34:
             tft.println("34                            ");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page33;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page41:
             tft.println("41                            ");
            if (!digitalRead(boutonp)) etat=page42;
            if (!digitalRead(boutonm)) etat=technicien;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page42:
             tft.println("42                            ");
            if (!digitalRead(boutonp)) etat=page43;
            if (!digitalRead(boutonm)) etat=page41;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page43:
             tft.println("43                            ");
            if (!digitalRead(boutonp)) etat=page44;
            if (!digitalRead(boutonm)) etat=page42;
             if (!digitalRead(boutonok)) etat=initial;
            break;
     
             case page44:
             tft.println("44                            ");
            if (!digitalRead(boutonp)) etat=initial;
            if (!digitalRead(boutonm)) etat=page43;
            if (!digitalRead(boutonok)) etat=initial;
            break;
     
            default:
            tft.println ("Erreur                        ");
          break;
        }
     
     
     
    }//fin loop
     
     
    unsigned long envoiMessage(char*texte) 
    {
     
      unsigned long start = micros();
     
     
      tft.println(texte);
     
      return micros() - start;
    }//fin envoimessage

  13. #13
    Modérateur

    Homme Profil pro
    Ingénieur électricien
    Inscrit en
    Septembre 2008
    Messages
    1 267
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : Suisse

    Informations professionnelles :
    Activité : Ingénieur électricien

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 267
    Points : 4 829
    Points
    4 829
    Par défaut
    Bonsoir

    Au risque de me répéter:
    Il devrait y avoir une lecture continue, un affichage en direct puis une attente de 1sec (c'est une bonne valeur au début) avant de prendre en compte un nouvel appuis sur la même touche. Cela nécessite de revoir la structure de la Loop();

    Pour le graphisme, faut voir la doc de la librairie que tu utilises. Pas trouvé sur le site de Adafruit. Soit il faudra dessiner par des lignes, cercle, etc... soit en stockant une image en format binaire dans la mémoire et la décharger sur l'affichage à la fin du setup();

    Delias

  14. #14
    Membre confirmé
    Avatar de deletme
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    257
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2011
    Messages : 257
    Points : 519
    Points
    519
    Par défaut
    Bonjour,

    Une petite question :
    1. Pourquoi ne pas utiliser d'interruption pour l'appui sur les boutons ?
    "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
    - Martin Golding
    Traduction obligatoire : "Toujours écrire du code en gardant en tête que le mec qui en assurera la maintenance est un psychopathe violent qui connait votre adresse"

Discussions similaires

  1. Problème d'affichage
    Par mustang-gx dans le forum Bases de données
    Réponses: 8
    Dernier message: 26/01/2005, 22h54
  2. Problème d'affichage avec trace
    Par WriteLN dans le forum Flash
    Réponses: 10
    Dernier message: 22/10/2003, 16h59
  3. [Kylix] problème d'affichage
    Par scalvi dans le forum EDI
    Réponses: 1
    Dernier message: 18/06/2003, 10h07
  4. Réponses: 1
    Dernier message: 06/03/2003, 11h57
  5. probléme d'affichage d'une fiche
    Par sb dans le forum Composants VCL
    Réponses: 7
    Dernier message: 29/08/2002, 09h43

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo