 
   }
 
-  if (currentMillis - previousMillis3 >= time3)
+  if ((currentMillis - previousMillis3 >= time3) && (start == true) )
   {
     serial_data();
     previousMillis3 = currentMillis;  // Remember the time

  File dataFile = SD.open(filename, FILE_WRITE);

  dataFile.println("millis,time,sat,lat,long,alt,heading,spd,ax_bi,ay_bi,az_bi,gx_bi,gy_bi,gz_bi,dist");
  
  //Serial.println(n);
  //Serial.println(filename);
  dataFile.close();
  //now filename[] contains the name of a file that doesn't exist



// *****************************************
// *************-- LOOP --******************
// *****************************************
// *****************************************

  //GPS
  Serial1.begin(9600);
  
    SeeedOled.clearDisplay();          //clear the screen and set start position to top left corner
  
}

void loop()


  readNMEA();

  //Serial.print(start);

  if ((gps.satellites.value() > 5) && (start == false)) {
    start = true;
    SeeedOled.clearDisplay();
  }

  if (currentMillis - previousMillis1 >= time1 && (start == true))
  {
    oled();
    previousMillis1 = currentMillis;  // Remember the time
