   Serial.begin (38400);
   pinMode(Trig_pin, OUTPUT);
   pinMode(2, INPUT_PULLUP);
-  pinMode(3, INPUT_PULLUP);
 }
 
 long check_distance() {
-  
+
   x = 0 ;
-  y = 0 ;
 
-  int distancex = 0;
-  int distancey = 0;
+  int distance = 0;
 
   for ( int i = 0 ; i < 2 ; i++ ) {
-    echoBufferx[i] = 0;
-    echoBuffery[i] = 0;
+    echoBuffer[i] = 0;
   }
 
-  attachInterrupt(0, echo1_Interrupt_Handler, CHANGE);
-  attachInterrupt(1, echo2_Interrupt_Handler, CHANGE);
+  attachInterrupt(0, echo_Interrupt_Handler, CHANGE);
 
   delay(200);
 

#include <Average.h>

#define Trig_pin 4

volatile unsigned long echoBufferx[2];
volatile unsigned long echoBuffery[2];

volatile unsigned int x = 0;
volatile unsigned int y = 0;

Average<float> ave(5);


}


void echo_Interrupt_Handler() {
  echoBuffer[x++] = micros();
}
