 
     updateLCD();
   }
+
+  //// EVERY DAY (Update Filename here before writing etc.)
+  if (day() != last_day)
+  {
+    last_day = day();
+#ifdef DO_LOGGING
+    getFilename();
+    Console.print("Filename set to: ");
+    Console.println(filePath);
+
+    lcd.clear();
+    lcd.print("Filename set to:");
+    lcd.setCursor(0, 1);
+    lcd.print(filename.substring(8)); // Assuming 8 chars is length of FILE_DIRECTORY
+    delay(2000);
+#endif
+  }
+
 
   //// EVERY 10 SECONDS
   // Read sensors every 10 seconds

  Console.println("Temp/Humidity Logging using DHT sensors");
  Console.print("DHT LIBRARY VERSION: ");
  Console.println(DHT_LIB_VERSION);
#ifdef DO_LOGGING
  Console.println("Logging Enabled");
  Console.print("Logging to");
  Console.println(FILE_PATH);
#else
  Console.println("Logging Disabled");
#endif

  // Update time  from server, and there-after every X 
  updateTimeFromServer(); // ~1.16s
  Console.print("Current time Set to: ");
  displayCurrentTime();
  Console.println("------");
}



dht DHT;

// Uncomment DO_LOGGING to enable logging data to SD card
#define DO_LOGGING 


#define FILE_DIRECTORY "/mnt/sd/"

// Pins 2/3 are hardwired for I2C on the Arduino Yun
#define DHT22_PIN 4
