+#include <Adafruit_Sensor.h>
 #include <Wire.h>
+#include <SPI.h>
+
+// SD card libraries
+#include <BlockDriver.h>
+//#include <FreeStack.h> // something is wrong with this library.
+#include <MinimumSerial.h>
+#include <SdFat.h>
+#include <SdFatConfig.h>
+#include <SysCall.h>
+
+// Sensor libraries.
+#include <Adafruit_BME280.h>
+#include <Adafruit_GPS.h>
+//#include <Adafruit_BNO055.h>
+#include <Adafruit_BME280.h>
 
 // RCR headers
 #include "Setupable.h"
 
+FILE file; // file manager
 SdFatSdio sd_card; // SD card manager
-File file; // file manager
+Adafruit_BME280 bme; // I2C connection to BME280
+
 
 // To shorten RCR namespace, use namespace alias "custom".
 namespace custom = rcr::level1payload;

// For more info, see "setupable.h".
//custom::Setupable* setupables[] = {  };

// Setup MicroSD card I/O. Trap the thread if no card is found.
void setup_sd_card(void) {
  if (!sd_card.begin()) {
    Serial.println("ERROR: SD card could not be found.");
    while (1) { /* Trap the thread. */ }
  }
  Serial.println("SdCard successfully setup.");
  Serial.println();
}

void setup() {

    Serial.println("File could not be initialized."); 
  }
  else {
    file.println("Writing this to file.");
    file.close(); // Close when finished.
  }
}

//void printBmpData(void) {
//  Serial.print("Temperature = ");
//  Serial.print(bmp.temperature());
//  Serial.println(" °C");
//
//  Serial.print("Ambient pressure = ");
//  Serial.print(bmp.ambient_pressure());
//  Serial.println(" Pa");
//
//  Serial.print("Pressure altitude = ");
//  Serial.print(bmp.pressure_altitude());
//  Serial.println(" meters");
//  Serial.println();
//}

bool written = false;

void loop() {
  //printBmpData();
  Serial.println("in loop");
  if (!written) {
    write_to_sd();
    written = true;
