 #ifdef DEBUG
   Serial.println("Logging a record to SD"); 
 #endif
-  myFile = SD.open("obidata.txt", FILE_WRITE);
+
+  myFile = SD.open(file_name.c_str(), FILE_WRITE);
+
 #ifdef DEBUG 
   if (myFile) {
     Serial.println("File open");

#endif

  // **************** SENSOR READING STAMP TIME ****************
  DateTime now = rtc.now();

  // **************** FOR SHARP SENSOR ****************
  digitalWrite(SHARP_LED_PIN, LOW); // power on the LED

  // **************** log data to serial output ****************
  
#ifdef DEBUG

    Serial.print(now.month());  Serial.print('/');
    Serial.print(now.day());    Serial.print('/');
    Serial.print(now.year());   Serial.print(' ');
    Serial.print(now.hour());   Serial.print(':');
    Serial.print(now.minute()); Serial.print(':');
    Serial.print(now.second()); Serial.print('\t');

    Serial.print(flat, 6); Serial.print(" ,");
    Serial.print(flon, 6); Serial.print(' ');
    
    Serial.print("\tSharp value: ");         Serial.print(sharp_dust_val);
    Serial.print("\tGrove Concentration: "); Serial.print(concentration);
    Serial.print("\tCO: ");                  Serial.print(gasLevel);
    Serial.print("\tHumidity: ");            Serial.print(h);
    Serial.print("\tTemp: ");                Serial.println(f);
    Serial.flush();
#endif

