Compteur millis() Besoin d'aide programmation

Mon code au complet !

#include <LiquidCrystal.h>

LiquidCrystal lcd (13,12,11,10,9,8);  


int iX;
int signX;
long valueX;
float resultX;
int clockpinX = 6;  
int datapinX = 7;

int iY;
int signY;
long valueY;
float resultY;
int clockpinY = 4;  
int datapinY = 5;

int iZ;
int signZ;
long valueZ;
float resultZ;
int clockpinZ = 2;  
int datapinZ = 3;

unsigned long tempmicrosX;
unsigned long tempmicrosY;
unsigned long tempmicrosZ;

void setup() {

  lcd.begin (20,4);   // Nature de l'écran LCD
  delay(500);
                    

  pinMode(clockpinX, INPUT);
  pinMode(datapinX, INPUT);
  
  pinMode(clockpinY, INPUT);
  pinMode(datapinY, INPUT);
  
  pinMode(clockpinZ, INPUT);
  pinMode(datapinZ, INPUT);

}
 void loop () {
  
   
  while (digitalRead(clockpinX)==HIGH) {} //if clock is LOW wait until it turns to HIGH
  tempmicrosX=micros();
  while (digitalRead(clockpinX)==LOW) {} //wait for the end of the HIGH pulse
  if ((micros()-tempmicrosX)>500) { //if the HIGH pulse was longer than 500 micros we are at the start of a new bit sequence
    decodeX(); //decode the bit sequence
  }

  while (digitalRead(clockpinY)==HIGH) {} //if clock is LOW wait until it turns to HIGH
  tempmicrosY=micros();
  while (digitalRead(clockpinY)==LOW) {} //wait for the end of the HIGH pulse
  if ((micros()-tempmicrosY)>500) { //if the HIGH pulse was longer than 500 micros we are at the start of a new bit sequence
    decodeY(); //decode the bit sequence
  }
  
  while (digitalRead(clockpinZ)==HIGH) {} //if clock is LOW wait until it turns to HIGH
  tempmicrosZ=micros();
  while (digitalRead(clockpinZ)==LOW) {} //wait for the end of the HIGH pulse
  if ((micros()-tempmicrosZ)>500) { //if the HIGH pulse was longer than 500 micros we are at the start of a new bit sequence
    decodeZ(); //decode the bit sequence
  }
}

//=======================================================================================================//
void decodeX() {
  signX=1;
  valueX=0;
  for (iX=0;iX<23;iX++) {
    while (digitalRead(clockpinX)==HIGH) { } //wait until clock returns to HIGH- the first bit is not needed
    while (digitalRead(clockpinX)==LOW) {} //wait until clock returns to LOW
    if (digitalRead(datapinX)==LOW) {
      if (iX<20) {
        valueX|= 1<<iX;
      }
      if (iX==20) {
        signX=-1;
      }
    }
  }
  
  resultX=(valueX*signX)/100.00;
  
            lcd.setCursor(0, 1);         
            lcd.print ("X:        ");
            lcd.setCursor(2, 1);         
            lcd.print (resultX,2);
            
   delay(5);
            
  }

//==================================================================================================//

void decodeY() {
  signY=1;
  valueY=0;
  for (iY=0;iY<23;iY++) {
    while (digitalRead(clockpinY)==HIGH) { } //wait until clock returns to HIGH- the first bit is not needed
    while (digitalRead(clockpinY)==LOW) {} //wait until clock returns to LOW
    if (digitalRead(datapinY)==LOW) {
      if (iY<20) {
        valueY|= 1<<iY;
      }
      if (iY==20) {
        signY=-1;
      }
    }
  }
 
  resultY=(valueY*signY)/100.00;
  
            lcd.setCursor(0, 2);         
            lcd.print ("Y:        ");
            lcd.setCursor(2, 2);         
            lcd.print (resultY,2);

  delay(5);            
           
 }           

//================================================================================================//

void decodeZ() {
  signZ=1;
  valueZ=0;
  for (iZ=0;iZ<23;iZ++) {
    while (digitalRead(clockpinZ)==HIGH) { } //wait until clock returns to HIGH- the first bit is not needed
    while (digitalRead(clockpinZ)==LOW) {} //wait until clock returns to LOW
    if (digitalRead(datapinZ)==LOW) {
      if (iZ<20) {
        valueZ|= 1<<iZ;
      }
      if (iZ==20) {
        signZ=-1;
      }
    }
  }
  
            resultZ=(valueZ*signZ)/100.00;

            lcd.setCursor(0, 3);         
            lcd.print ("Z:        "); 
            lcd.setCursor(2, 3);         
            lcd.print (resultZ,2);

  delay(5);

}