Find fundamental frequency using FFT

Yes of cours here it is :

look at the Step 6

I've changed the void loop a bit as there seemed to be a lot of noise so for a D string I have this :

void loop(){
  
  checkClipping();
  
  frequency = 38462/float(period);//calculate frequency timer rate/period
  if(100<frequency and frequency<180 and c-15<frequency and frequency<c+15){

  Serial.print(frequency);
  Serial.println(" hz");
  c=frequency;
  }
  delay(80);//feel free to remove this if you want
  
  //do other stuff here
}

I know it's really minimalist and a bit do-it-yourself but results satisfy me so that's why I try to use FFT and PLL now to compare them