 int i = 0;
 int j = 0;
 float runningSum = 0;
+float oldAverage;
 bool int_flag = false;
 
 void setup() {

    entries[i] = readGyro();
    runningSum += entries[i];
  } // fill up the rolling average
  
  xy.attach(3); // pro mini pwm pin
  xy.write(0); // Start at a well-defined value

    runningSum -= entries[j % 10];
    entries[j % 10] = readGyro();
    runningSum += entries[j % 10];
    float newAverage = getAverage();
    Serial.println(newAverage - oldAverage, 2); // Print drift in 100 ms
    oldAverage = newAverage;
    j++;
    int_flag = false;
  }
