 #include <SoftwareSerial.h>
 
 #include <Adafruit_GPS.h>
+#include <Adafruit_BMP085_U.h>
+#include <Adafruit_LSM303_U.h>
+#include <Adafruit_L3GD20_U.h>
 #include <Adafruit_10DOF.h>
 
 #define tonePin 6
 #define errorFrequency 440 //Concert A
 #define chipSelect 10
 #define ledPin 13
-
-
 #define debug 1
 
 typedef enum {

      error(FILE_INIT);
    }

    
    
}

void loop() {
  char c = GPS.read();
  if (debug && c) Serial.print(c);

  
  
  



  
  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) {
    char *stringptr = GPS.lastNMEA();
    
    if (!GPS.parse(stringptr))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another

    // Sentence parsed! 
    if (!GPS.fix && debug) {
      Serial.print("No Fix");
      return;
    }

    uint8_t stringsize = strlen(stringptr);
    if (stringsize != logfile.write((uint8_t *)stringptr, stringsize)) error(LOG_WRITE);
    if (strstr(stringptr, "RMC") || strstr(stringptr, "GGA")) logfile.flush();
  }
  
}

void error(uint8_t errno) {

    }
    
  // Opening file for log
    String filename = "LOG00.csv";
    for (uint8_t i = 0; i < 100; i++) {
      filename[3] = '0' + i/10;
      filename[4] = '0' + i%10;
      // create if does not exist, do not open existing, write, sync after write
      if (!SD.exists(filename)) break;
    }
