   
   float g = (gRaw * 250.0) / 32768.0;
   return g;
+}
+
+boolean detect(int pingValue) {
+  return pingValue < thresh && pingValue > 0;
 }
 
 void printinfo(float doorAngle, int ping_1, int ping_2) {

  return filter.getYaw();
}

float convertRawAcceleration(int aRaw) {
  // since we are using 2G range
  // -2g maps to a raw value of -32768

  // initialize variables to pace updates to correct rate
  microsPerReading = 1000000 / 25;
  microsPrevious = micros();
  microsBetweenReads = 1000000 / 2; // must wait half a second between consecutive reads
  microsLastRead = micros();

  // get initial angle of the door
  // startAngle = measureYaw();
