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 de lecture d'un encodeur rotatif en liaison TX/RX


Sujet :

Arduino

  1. #1
    Membre confirmé
    Homme Profil pro
    pompier
    Inscrit en
    Janvier 2020
    Messages
    93
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : pompier

    Informations forums :
    Inscription : Janvier 2020
    Messages : 93
    Par défaut Problème de lecture d'un encodeur rotatif en liaison TX/RX
    bonjour,
    j'ai un carte arduino micro pro connectée à mon pc. via les pin rx et tx elle est reliée à une carte arduino mega 2556 (sur pin 18 et 19).

    Le but est de créer un joystick plutôt boite à boutons pour jouer sur simulateur de vol (DCS World pour ceux qui connaissent).
    Il n'y a que des interrupteurs double ou triple position (on/off , on/off/on) et je souhaite aussi avoir de encodeur rotatifs KY-040

    Les 2 programmes fonctionnent avec des boutons simples. . pour le moment mon code est

    MEGA
    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
    // =====================================================
    // BOUTONS MEGA (50 boutons)
    // =====================================================
     
    #define BUTTON1   2
    #define BUTTON2   3
    #define BUTTON3   4
    #define BUTTON4   5
    #define BUTTON5   6
    #define BUTTON6   7
    #define BUTTON7   8
    #define BUTTON8   9
    #define BUTTON9   10
    #define BUTTON10  11
    #define BUTTON11  12
    #define BUTTON12  13
     
    #define BUTTON13  22
    #define BUTTON14  23
    #define BUTTON15  24
    #define BUTTON16  25
    #define BUTTON17  26
    #define BUTTON18  27
     
    // 28 = ENCODEUR A
    // 30 = ENCODEUR B
     
    #define BUTTON19  29
    #define BUTTON20  31
    #define BUTTON21  32
    #define BUTTON22  33
    #define BUTTON23  34
    #define BUTTON24  35
    #define BUTTON25  36
    #define BUTTON26  37
    #define BUTTON27  38
    #define BUTTON28  39
    #define BUTTON29  40
    #define BUTTON30  41
    #define BUTTON31  42
    #define BUTTON32  43
    #define BUTTON33  44
    #define BUTTON34  45
    #define BUTTON35  46
    #define BUTTON36  47
    #define BUTTON37  48
    #define BUTTON38  49
    #define BUTTON39  50
    #define BUTTON40  51
    #define BUTTON41  52
    #define BUTTON42  53
    #define BUTTON43  A0
    #define BUTTON44  A1
    #define BUTTON45  A2
    #define BUTTON46  A3
    #define BUTTON47  A4
    #define BUTTON48  A5
    #define BUTTON49  A6
    #define BUTTON50  A7
     
    // =====================================================
    // TABLEAU DES PINS BOUTONS
    // =====================================================
     
    const byte NUM_BUTTONS = 50;
     
    const byte buttonPins[NUM_BUTTONS] = {
      BUTTON1,  BUTTON2,  BUTTON3,  BUTTON4,
      BUTTON5,  BUTTON6,  BUTTON7,  BUTTON8,
      BUTTON9,  BUTTON10, BUTTON11, BUTTON12,
     
      BUTTON13, BUTTON14, BUTTON15, BUTTON16,
      BUTTON17, BUTTON18, BUTTON19, BUTTON20,
      BUTTON21, BUTTON22, BUTTON23, BUTTON24,
      BUTTON25, BUTTON26, BUTTON27, BUTTON28,
      BUTTON29, BUTTON30, BUTTON31, BUTTON32,
      BUTTON33, BUTTON34, BUTTON35, BUTTON36,
      BUTTON37, BUTTON38, BUTTON39, BUTTON40,
      BUTTON41, BUTTON42, BUTTON43, BUTTON44,
      BUTTON45, BUTTON46, BUTTON47, BUTTON48,
      BUTTON49, BUTTON50
    };
     
    // =====================================================
    // ENCODEUR KY-040 (méthode simple)
    // =====================================================
     
    #define ENCODER_A 28
    #define ENCODER_B 30
     
    int lastCLK;
     
    // =====================================================
    // DONNÉES DES BOUTONS
    // =====================================================
     
    byte buttons[7] = {0};
     
    // =====================================================
    // SETUP
    // =====================================================
     
    void setup() {
     
      Serial.begin(115200);     // Debug
      Serial1.begin(115200);    // Vers Pro Micro
     
      // Configuration des boutons
      for (byte i = 0; i < NUM_BUTTONS; i++) {
        pinMode(buttonPins[i], INPUT_PULLUP);
      }
     
      // Encodeur
      pinMode(ENCODER_A, INPUT_PULLUP);
      pinMode(ENCODER_B, INPUT_PULLUP);
     
      lastCLK = digitalRead(ENCODER_A);
     
      Serial.println("=== MEGA OK ===");
    }
     
    // =====================================================
    // ENCODEUR SIMPLE
    // =====================================================
     
    byte readEncoderSimple() {
     
      int currentCLK = digitalRead(ENCODER_A);
     
      if (currentCLK != lastCLK) {
     
        int currentDT = digitalRead(ENCODER_B);
     
        lastCLK = currentCLK;
     
        if (currentDT != currentCLK) {
          return 1;   // droite
        } else {
          return 2;   // gauche
        }
      }
     
      return 0;
    }
     
    // =====================================================
    // LOOP
    // =====================================================
     
    void loop() {
     
      // ---------------------------------------------------
      // Lecture des boutons
      // ---------------------------------------------------
     
      for (byte i = 0; i < 7; i++) buttons[i] = 0;
     
      for (byte i = 0; i < NUM_BUTTONS; i++) {
        if (!digitalRead(buttonPins[i])) {
          buttons[i / 8] |= (1 << (i % 8));
        }
      }
     
      // ---------------------------------------------------
      // Lecture encodeur
      // ---------------------------------------------------
     
      byte encoderEvent = readEncoderSimple();
     
      if (encoderEvent != 0) {
        Serial.print("ENCODEUR = ");
        Serial.println(encoderEvent);
      }
     
      // ---------------------------------------------------
      // Envoi du paquet
      // ---------------------------------------------------
     
      Serial1.write(0xAA);
      Serial1.write(buttons, 7);
      Serial1.write(encoderEvent);
     
      delay(1);
    }
    MICRO PRO
    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
    #include "Joystick.h"
     
    // =====================================================
    // BOUTONS LOCAUX
    // =====================================================
     
    #define joyButton1  2
    #define joyButton2  3
    #define joyButton3  4
    #define joyButton4  5
    #define joyButton5  6
    #define joyButton6  7
    #define joyButton7  8
    #define joyButton8  9
    #define joyButton9  A2
    #define joyButton10 A1
    #define joyButton11 A0
    #define joyButton12 15
     
    // =====================================================
    // AXES
    // =====================================================
     
    #define joyRZ       A3
    #define joyThrottle A3
     
    // =====================================================
    // TABLEAU DES BOUTONS LOCAUX
    // =====================================================
     
    const byte unoButtonPins[12] = {
     
    joyButton1,
    joyButton2,
    joyButton3,
    joyButton4,
    joyButton5,
    joyButton6,
    joyButton7,
    joyButton8,
    joyButton9,
    joyButton10,
    joyButton11,
    joyButton12
    };
     
    // =====================================================
    // JOYSTICK USB
    // =====================================================
    //
    // 12 boutons locaux
    // 50 boutons Mega
    // 2 boutons encodeur
    //
    // TOTAL = 64 boutons
    //
    // 0 à 11  = boutons locaux
    // 12 à 61 = boutons Mega
    // 62      = encodeur droite
    // 63      = encodeur gauche
    // =====================================================
     
    Joystick_ Joystick(
      0x15,
      JOYSTICK_TYPE_JOYSTICK,
      32,
      0,
      true, true, false, false, false, true,
      false, true, false, false, false
    );
     
     
    // =====================================================
    // DONNÉES REÇUES DE LA MEGA
    // =====================================================
     
    // 50 boutons = 7 octets
     
    byte megaButtons[7] = {
    0
    };
     
    // =====================================================
    // ÉVÉNEMENT ENCODEUR
    // =====================================================
    //
    // 0 = aucun mouvement
    // 1 = rotation droite
    // 2 = rotation gauche
    // =====================================================
     
    byte megaEncoderEvent = 0;
     
    // =====================================================
    // RÉCEPTION DES DONNÉES DE LA MEGA
    // =====================================================
    //
    // Trame reçue :
    //
    // 0xAA
    // + 7 octets boutons
    // + 1 octet encodeur
    //
    // TOTAL = 9 octets
    // =====================================================
     
    void receiveMegaData() {
     
    static byte state = 0;
     
    while (Serial1.available()) {
     
     
    byte data = Serial1.read();
     
     
    // -------------------------------------------------
    // ATTENTE DU HEADER
    // -------------------------------------------------
     
    if (state == 0) {
     
     
      if (data == 0xAA) {
     
        state = 1;
      }
    }
     
     
    // -------------------------------------------------
    // RÉCEPTION DES 7 OCTETS DE BOUTONS
    // -------------------------------------------------
     
    else if (state >= 1 && state <= 7) {
     
     
      megaButtons[state - 1] = data;
     
      state++;
    }
     
     
    // -------------------------------------------------
    // RÉCEPTION DE L'ÉVÉNEMENT ENCODEUR
    // -------------------------------------------------
     
    else if (state == 8) {
     
     
      megaEncoderEvent = data;
     
      state = 0;
    }
     
     
    }
    }
     
    // =====================================================
    // SETUP
    // =====================================================
     
    void setup() {
     
    // ---------------------------------------------------
    // CONFIGURATION DES BOUTONS LOCAUX
    // ---------------------------------------------------
     
    for (byte i = 0; i < 12; i++) {
     
     
    pinMode(
     
      unoButtonPins[i],
     
      INPUT_PULLUP
    );
     
     
    }
     
    // ---------------------------------------------------
    // LIAISON SÉRIE AVEC LA MEGA
    // ---------------------------------------------------
     
    Serial1.begin(115200);
     
    // ---------------------------------------------------
    // INITIALISATION DU JOYSTICK USB
    // ---------------------------------------------------
     
    Joystick.begin();
    }
     
    // =====================================================
    // LOOP
    // =====================================================
     
    void loop() {
     
    // ---------------------------------------------------
    // RÉCEPTION DES DONNÉES DE LA MEGA
    // ---------------------------------------------------
     
    receiveMegaData();
     
    // ---------------------------------------------------
    // AXES
    // ---------------------------------------------------
     
    Joystick.setRzAxis(
     
     
    analogRead(joyRZ)
     
     
    );
     
    Joystick.setThrottle(
     
     
    analogRead(joyThrottle)
     
     
    );
     
    // ---------------------------------------------------
    // BOUTONS LOCAUX
    // ---------------------------------------------------
    //
    // Boutons joystick 0 à 11
    // ---------------------------------------------------
     
    for (byte i = 0; i < 12; i++) {
     
     
    Joystick.setButton(
     
      i,
     
      !digitalRead(unoButtonPins[i])
    );
     
     
    }
     
    // ---------------------------------------------------
    // BOUTONS DE LA MEGA
    // ---------------------------------------------------
    //
    // Boutons joystick 12 à 61
    // ---------------------------------------------------
     
    for (byte i = 0; i < 50; i++) {
     
     
    byte byteNumber = i / 8;
     
     
    byte bitNumber = i % 8;
     
     
    bool buttonState =
     
      megaButtons[byteNumber]
      &
      (1 << bitNumber);
     
     
    Joystick.setButton(
     
      12 + i,
     
      buttonState
    );
     
     
    }
     
    // ---------------------------------------------------
    // ENCODEUR ROTATIF
    // ---------------------------------------------------
    //
    // Bouton 62 = rotation droite
    // Bouton 63 = rotation gauche
    //
    // Chaque rotation génère une courte impulsion.
    // ---------------------------------------------------
     
    if (megaEncoderEvent == 1) {
      Joystick.setButton(30, true);
      delay(20);
      Joystick.setButton(30, false);
      megaEncoderEvent = 0;
    }
     
    else if (megaEncoderEvent == 2) {
      Joystick.setButton(31, true);
      delay(20);
      Joystick.setButton(31, false);
      megaEncoderEvent = 0;
    }
     
    // ---------------------------------------------------
    // PETITE PAUSE
    // ---------------------------------------------------
     
    delay(5);
    }
    sur le moniteur série de la MEGA, j'ai bien les bonnes infos. Je vois bien la LED TX qui s'affiche à chaque changement de cran du rotateur.
    sur le moniteur série de la MICRO, rien. Il semblerait que ça ne code pas comme il faut de la mega vers micro.

    Merci par avance pour votre aide.

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


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

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Janvier 2009
    Messages : 13 419
    Billets dans le blog
    48
    Par défaut
    Salut,

    Normalement, tu as connecté les Tx1/Rx1 de la Mega vers les Rx1/Tx1 de la micro pro, en croisant Rx/Tx. As-tu pensé à relier les GND des deux cartes (masse commune) ?

  3. #3
    Membre confirmé
    Homme Profil pro
    pompier
    Inscrit en
    Janvier 2020
    Messages
    93
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : pompier

    Informations forums :
    Inscription : Janvier 2020
    Messages : 93
    Par défaut
    bonjour f-leb,
    oui j'ai connecté les gnd des 2 cartes entre elles.

    Pour être franc, je ne sais pas trop développer, du coup, je me suis servi de copilot (j'espère ne pas être bani ).

    Du coup, selon lui j'avais un problème de synchronisation. Il m'a fait mettre ce code dans la micro:


    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
    #include <Joystick.h>
     
    // Joystick HID 32 boutons
    Joystick_ Joystick(
      0x15,
      JOYSTICK_TYPE_JOYSTICK,
      32,
      0,
      true, true, false, false, false, true,
      false, true, false, false, false
    );
     
    // 12 boutons locaux
    #define joyButton1  2
    #define joyButton2  3
    #define joyButton3  4
    #define joyButton4  5
    #define joyButton5  6
    #define joyButton6  7
    #define joyButton7  8
    #define joyButton8  9
    #define joyButton9  A2
    #define joyButton10 A1
    #define joyButton11 A0
    #define joyButton12 15
     
    const byte unoButtonPins[12] = {
      joyButton1, joyButton2, joyButton3, joyButton4,
      joyButton5, joyButton6, joyButton7, joyButton8,
      joyButton9, joyButton10, joyButton11, joyButton12
    };
     
    // Données reçues de la MEGA
    byte megaButtons[7];
    byte megaEncoderEvent = 0;
     
    // =====================================================
    // RÉCEPTION ROBUSTE (FIXE LE PROBLÈME 0,0,0,170)
    // =====================================================
     
    void receiveMegaData() {
     
      static byte state = 0;
      static byte index = 0;
     
      while (Serial1.available()) {
     
        byte data = Serial1.read();
     
        switch (state) {
     
          // Attente du header 0xAA
          case 0:
            if (data == 0xAA) {
              state = 1;
              index = 0;
            }
            break;
     
          // Lecture des 7 octets boutons
          case 1:
            megaButtons[index] = data;
            index++;
     
            if (index >= 7) {
              state = 2;
            }
            break;
     
          // Lecture de l'octet encodeur
          case 2:
            megaEncoderEvent = data;
            state = 0;   // prêt pour la prochaine trame
            break;
        }
      }
    }
     
    // =====================================================
    // SETUP
    // =====================================================
     
    void setup() {
     
      Serial.begin(115200);     // Debug
      Serial1.begin(115200);    // Liaison MEGA → MICRO
     
      for (byte i = 0; i < 12; i++) {
        pinMode(unoButtonPins[i], INPUT_PULLUP);
      }
     
      Joystick.begin();
    }
     
    // =====================================================
    // LOOP
    // =====================================================
     
    void loop() {
     
      receiveMegaData();
     
      // Boutons locaux 0–11
      for (byte i = 0; i < 12; i++) {
        Joystick.setButton(i, !digitalRead(unoButtonPins[i]));
      }
     
      // Boutons Mega 12–61
      for (byte i = 0; i < 50; i++) {
     
        byte byteNumber = i / 8;
        byte bitNumber  = i % 8;
     
        bool buttonState = megaButtons[byteNumber] & (1 << bitNumber);
     
        Joystick.setButton(12 + i, buttonState);
      }
     
      // Encodeur → boutons 30 et 31
      if (megaEncoderEvent == 1) {
        Serial.println("Recu : 1");
        Joystick.setButton(30, true);
        delay(20);
        Joystick.setButton(30, false);
        megaEncoderEvent = 0;
      }
     
      else if (megaEncoderEvent == 2) {
        Serial.println("Recu : 2");
        Joystick.setButton(31, true);
        delay(20);
        Joystick.setButton(31, false);
        megaEncoderEvent = 0;
      }
     
      delay(1);
    }
    Bref, quand je regarde pour chaque carte l'écran, pour la MEGA, c'est très fluide sur la détection du rotateur, en revanche, pour la micro, c'est hyper lent pas gérable pour de la simulation.

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


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

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Janvier 2009
    Messages : 13 419
    Billets dans le blog
    48
    Par défaut
    Le problème est que l'arduino micro est fortement ralenti par des traitements (50 boutons !) et du code bloquant (présence de delay() dans le code).
    Pendant que le traitement est bloqué dans un delay(), et si tu continues de tourner l'encodeur, tu risques de perdre des crans ou de les transmettre avec retard, d'où cette impression de lenteur car la micro ne consomme pas les données assez vite.

    La première chose à faire est de supprimer les delay() en jouant avec la fonction millis()...

  5. #5
    Membre confirmé
    Homme Profil pro
    pompier
    Inscrit en
    Janvier 2020
    Messages
    93
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : France, Eure et Loir (Centre)

    Informations professionnelles :
    Activité : pompier

    Informations forums :
    Inscription : Janvier 2020
    Messages : 93
    Par défaut
    en fait, je suis parti sur une autre stratégie pour les encodeurs, je les branche directement sur la micro pro, du coup plus de problème de liaison, lecture du signal pour cet équipement.
    j'ai mis le code dans la micro et ça fait le job.

    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
    if (A == B) {
      // DROITE
      for (int i = 0; i < 3; i++) {   // 3 impulsions par cran
        Joystick.setButton(30, true);
        delay(5);
        Joystick.setButton(30, false);
        delay(5);
      }
    } else {
      // GAUCHE
      for (int i = 0; i < 3; i++) {
        Joystick.setButton(31, true);
        delay(5);
        Joystick.setButton(31, false);
        delay(5);
      }
    }
    Maintenant reste à voir effectivement si avec les boutons ça reste fluide.

    Ce qui me rassure de prime abord, c'est que l'on joue peu avec les switchs, idem pour les encodeurs et en plus un à la fois donc même s'il y a quelques millisecondes de latence voir 1 seconde ce ne sera pas la fon du monde.
    je fais l'essai et je vous tiens au courant. MAas ça sent bon.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème encodeur rotatif
    Par hugobeauce dans le forum Arduino
    Réponses: 3
    Dernier message: 28/05/2024, 09h34
  2. Réponses: 17
    Dernier message: 25/03/2022, 16h45
  3. Encodeur rotatif absolu
    Par Guesset dans le forum Embarqué
    Réponses: 21
    Dernier message: 26/01/2022, 17h27
  4. Commande PWM moteur CC, lecture encodeur
    Par Horus68 dans le forum Arduino
    Réponses: 49
    Dernier message: 30/04/2021, 18h39
  5. Réponses: 17
    Dernier message: 21/01/2019, 17h47

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