Measure of speed, a beginer needs (more) help

In continuation of my previous 2 posts, I still am stuck on some few things without any idea how to solve them.

I would like to measure the speed and jerk of a rotating cylinder. I am using a optical sensor.
I need to have the speed measures in a table in order to calculate the 2nd derivative i.e. jerk but I'm unable to do so.

Here's the program :

#define SO 18 //Optical sensor
#define HT 19 // Clock

float vitesse = 0.0 ; //speed in french


volatile unsigned long T1;
volatile unsigned long T2;
unsigned long T2_c;
unsigned long T1_c;
unsigned long dT_op;

volatile byte b=0;
int b_c=0;

int NbMesures = 9;
float Vitesse[9];
int MesIndex=0;
long total=0;

float Temps[9]; //Temps is time in french
float Jerk_tab[9];

int i;
int j;
long DT;


void setup() {
  Serial.begin(9600);
  
  pinMode(HT, INPUT);
  attachInterrupt(digitalPinToInterrupt(HT), Clock, RISING);
  pinMode(SO, INPUT);
  attachInterrupt(digitalPinToInterrupt(SO), readSO, RISING);
  pinMode(motor,OUTPUT);

}


void  Clock(){
  b = b+1;
}

void readSO(){
  T1=T2;
  T2=micros();

}

void loop() {
  noInterrupts();
  T2_c = T2;
  T1_c = T1;
  b_c = b;
  interrupts();
  dT_op = T2_c-T1_c;
  vitesse = (1e6)/ (16*dT_op);

  Vitesse[MesIndex] = vitesse;
  Temps[MesIndex] = T2_c;
 
  
  if (MesIndex==0){
    i = 9;
    j = 8;
  }
  else if (MesIndex==1){
    i=0;
    j=9;
  }
  else{
    i = MesIndex-1;
    j = MesIndex-2;
  }
  
  //2nd derivative i.e. Jerk :
  DT = Temps[MesIndex] - Temps[i];
  Jerk_tab[MesIndex] = (Vitesse[j] - 2*Vitesse[i] + Vitesse[MesIndex])*1e12 / (DT*DT);

 
  if (b_c>2){
    Serial.print(" vitesse : ");
    Serial.print(Vitesse[MesIndex]);
    Serial.print(",");
    Serial.print(" Temps : ");
    Serial.print(Temps[MesIndex]);
    Serial.print(",");
    Serial.print(" jerk : ");
    Serial.print(Jerk_tab[MesIndex]);
    Serial.print(",");
    Serial.print(" DT : ");
    Serial.print(DT);
    Serial.print(" MesIndex : ");
    Serial.print(MesIndex);
    Serial.println();
    noInterrupts();
    b=0;
    interrupts();
    b_c=0;
  }
  
  MesIndex = MesIndex+1;
  if (MesIndex>9){
    MesIndex=0;
  }
  
}

Here's the assembly, the wiring is not the one I'm using it was for another issue..

image


White is the optical sensor, blue and black ground of generator and optical sensor, red is 5V of optical sensor and green is the 10Hz signal recieved by generator.
image

Here's what's printed :

The moment I start rotating the cylinder, the printing stops...
I don't understand a thing

If any of you guys have any idea, i would love to hear it!