     }
     for (int i = 0; i < samplesRead; i++) {
       float newVal = tempBuffer[i];
+      //acc += newVal * newVal;
       acc += newVal;
       numInAcc++;
       if (numInAcc >= ACC_SIZE) {
           float value = acc / ACC_SIZE;
           acc = 0;
           numInAcc = 0;
-          //minwave = min(value, minwave);
-          //maxwave = max(value, maxwave);
-          addToFFT(value);
+          addToFFT(value * value);
+          // addToFFT(value);
       }
-      // minwave = min(tempBuffer[i], minwave);
-      // maxwave = max(tempBuffer[i], maxwave);
 
       //samples--;
     }

  sht30.begin();
  PDM.onReceive(onPDMdata);
  PDM.begin(1, 16000);

  // init hann window
  for (int i = 0; i < HANN_SIZE ; i++) {

  fft_phase(FS, 0, F2, FFT_SIZE, fftBuffer, mag, phase, startIndex, endIndex);
  updatePhase(mag, phase, startIndex, endIndex);
  float hz = FS * _phaseRateAverage / 2 / PI;
  // Serial.print("endIndex: "); Serial.println(endIndex);
  // Serial.print("END_INDEX: "); Serial.println(END_INDEX);
  // Serial.print("BPM: "); Serial.println(hz * 60);
  //Serial.print("radsPerUpdate: "); Serial.println(_phaseRateAverage);

