     dataFile.close();
   }
   else{
-    
+
     Serial.println("error writing text to disk data.txt");
   }
 }


  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("data.txt", FILE_WRITE);  
  
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  // retrieve data from DS3231
  readDS3231time(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month,
  &year);
 
  // if the file is available, write to it:
  if (dataFile) {
    delay(50);

      timeCount++;
      clock.clearAlarm1();
    }

  //At this point, the ISR from the clock alarm woke up the
  //processor and the alarm flag is set. Clear the flag and
  //handle whatever we need to do.
  else {
#if DEBUG_TO_SD
  write_Text_To_Disk("data.txt","Woke up, logging");
#endif

#if DEBUG
    Serial.println("ALARM TRIGGERED!");
#endif
    delay(1);

    //we finally hit the specified number of minutes to run, reset and log
    timeCount = 0;

    float temperature = getTemp();
    delay(5);
    append_to_disk(temperature);
#if DEBUG
    Serial.println(temperature);
#endif

    //clear alarm flag and update time To sleep
    clock.clearAlarm1();

  }

}
