 volatile unsigned int x = 0;
 volatile unsigned int y = 0;
 
-int distancex ;
-int distancey ;
+Average<float> ave(5);
 
 void setup() {
   Serial.begin (38400);

#define Trig_pin 4

volatile unsigned long echoBufferx[2];

  pinMode(3, INPUT_PULLUP);
}

long check_distance() {
  
  x = 0 ;
  y = 0 ;

  int distancex = 0;
  int distancey = 0;

  for ( int i = 0 ; i < 2 ; i++ ) {
    echoBufferx[i] = 0;
