encodeur rotatif et compte à rebours besoin d'aide svp

mulderfox:
Merci pour l'info, et quelle est ta suggestion pour faire fonctionner ce codeur dans mon code ?

bonjour
le code ci-dessous fontionne
avecGND sur GND
CLK sur pin2 uno DT sur pin3

int val;
int PinCLK = 2;
int PinDT = 3;
int PinSW = 0;
static long encoderPos = -1;    // Au 1er démarrage, il passera à 0
int PinCLKLast = LOW;
int nbPas = 20;                 // Résolution de l'encodeur
int n = LOW;

void setup() {
  pinMode (PinCLK, INPUT_PULLUP);
  pinMode (PinDT, INPUT_PULLUP);
  pinMode (PinSW,INPUT);
  Serial.begin (9600);
}

void loop() {
   if (!(digitalRead(PinSW))) {      // Reset la position si on appui sur le potentiomètre
     encoderPos = 0;
     //Serial.println("Reset position");
   }
   
   n = digitalRead(PinCLK);
   
   if ((PinCLKLast == LOW) && (n == HIGH)) {
     
     if (digitalRead(PinDT) == LOW) {
       Serial.print("Sens antihoraire, position ");
       encoderPos--;
       if ( encoderPos < 0 ) {
         encoderPos = nbPas;
       }
     } else {
       Serial.print("Sens horaire, position ");
       encoderPos++;
       if ( encoderPos > ( nbPas - 1 ) ) {
         encoderPos = 0;
       }
     }
     Serial.print (encoderPos); Serial.print(", angle "); Serial.println( abs ( encoderPos * ( 360 / nbPas ) ) );
     //Serial.print ("/");
   }
   PinCLKLast = n;
 }