     Serial.println(" GND     | GND");
     Serial.println(" A4      | SDA");
     Serial.println(" A5      | SCL");
-    while (1) {
+    while (!imu.begin()) {
+      Serial.println(" [ FAILED ] ");
       blinkLED();
+      Serial.print("Connecting...");
+      delay(1000);
     }
+    Serial.println("[ SUCCESS ] ");
   }
   Serial.println(" [ DONE ] ");
   

    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

int i = 0;
int j = 0;
float runningSum = 0;
float oldAverage;
bool int_flag = false;

void setup() {
