 
 boolean startSD()
 {
+  Serial.print("Initializing SD card...");
+  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
+  // Note that even if it's not used as the CS pin, the hardware SS pin 
+  // (10 on most Arduino boards, 53 on the Mega) must be left as an output 
+  // or the SD library functions will not work. 
+  pinMode(10, OUTPUT);
+
   if (!SD.begin(4)) {
     Serial.println("initialization failed!");
     return false;

#include <SD.h> // Modified SD.cpp in SD library to allow for multiple SD.begin() calls
// Add to Line 343 of SD.cpp: 'if (root.isOpen()) {root.close();}'

File myFile;
void readFileToSerial()
{
  // re-open the file for reading:
  myFile = SD.open("mtest.txt");
  if (myFile) {
    Serial.println("mtest.txt:");
    
    // read from the file until there's nothing else in it:
    while (myFile.available()) {

}

boolean buttonPressed = false;
void buttonInterrupt()
{
  buttonPressed = true;
}

void doButtonCall()
{
  delay(250);
  Serial.println("Woo");
  if (startSD())
  {
    // Read thermistors
    int tempA = thermistorA.getReading();
    int tempB = thermistorB.getReading();

    logToFile(FILENAME, tempA);
    logToFile(FILENAME, tempB);
    readFileToSerial(FILENAME);
  }
  buttonPressed = false;

}

void setup()
{
  Serial.begin(9600);  
  
  // if (!startSD())
  // {
  //   return;
  // }
  
  // logToFile(FILENAME, counter);  
  // readFileToSerial(FILENAME);

  attachInterrupt(0, buttonInterrupt, RISING);
}

void loop()
{
  if (buttonPressed)
  {
    doButtonCall();
  }
}

