#include "libencodeur.h"

CStateMachineRotaryWithSpeedAndReset encoder2(A0,A1,A2);
CStateMachineRotary encoder1(A4,A5);

void setup() {
Serial.begin(115200);
}

void loop() {
  encoder1.clock();
  encoder2.clock();
//affichage de la valeur mesurée 10 fois par seconde
  unsigned int periodiciteTache1=100;
  static unsigned long timerTache1 = millis();
  if (millis() - timerTache1 >= periodiciteTache1) {
      timerTache1 += periodiciteTache1;
      Serial.println(encoder1.getPosition());
      Serial.print(" ");
      Serial.println(encoder2.getPosition());
      Serial.print(" ");
      Serial.println(encoder2.getSpeed());

  }

  unsigned int periodiciteTache2=10000;       //10s
  static unsigned long timerTache2 = millis();
  if (millis() - timerTache2 >= periodiciteTache2) {
      timerTache2 += periodiciteTache2;
      encoder1.setPosition(encoder1.getPosition()+4);
  }
 
}
D0D1D2D3D4D5D6D7GNDLOGIC