 #include <Adafruit_SHT31.h>
 #include <Adafruit_Sensor.h>
 #include <PDM.h>
+#include <KickFFT.h>
+
+#define ACC_SIZE 64
+#define FFT_SIZE 512
 
 Adafruit_APDS9960 apds9960; // proximity, light, color, gesture
 Adafruit_BMP280 bmp280;     // temperautre, barometric pressure

  int bytesAvailable = PDM.available();

  // read into the sample buffer
  PDM.read(sampleBuffer, bytesAvailable);

  // 16-bit, 2 bytes per sample
  samplesRead = bytesAvailable / 2;

      continue;
    }
    for (int i = 0; i < samplesRead; i++) {
      float newVal = tempBuffer[i];
      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);
      }
      // minwave = min(tempBuffer[i], minwave);
      // maxwave = max(tempBuffer[i], maxwave);

      //samples--;
    }
    // clear the read count
    samplesRead = 0;
  }
  Serial.print("max: ");
  Serial.println(maxwave);
  Serial.print("min: ");
  Serial.println(minwave);
  return maxwave - minwave;
}

