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

#include <Adafruit_SHT31.h>
#include <Adafruit_Sensor.h>
#include <PDM.h>

Adafruit_APDS9960 apds9960; // proximity, light, color, gesture
Adafruit_BMP280 bmp280;     // temperautre, barometric pressure

  int bytesAvailable = PDM.available();

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

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