 // Read and record data to log files
 void recordData()
 {
-  Alarm.delay(250);
+  delay(250);
   Serial.println("Woo");
   if (startSD())
   {

  return true;
}

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

void updateTemperatures()

  else
    Serial.println("RTC has set the system time");

  // Since we're using a filter call update several times to populate
  for (int i = 0; i < 50; ++i)
  {
    updateTemperatures();
    delay(20);
  }

  // Set button to write to file
  attachInterrupt(0, buttonInterrupt, RISING);

  // Set call to update files every minute
  // Alarm.timerRepeat(60, buttonInterrupt);

  // Update LCD screenevery second
  // Alarm.timerRepeat(1, triggerLCD);

  // Done
  lcd.setCursor(0,1);
  lcd.print("Initialized.");
  delay(500);
  lcd.clear();
}

int lastMinute = -1;
int lastSecond = -1;
void loop()
{
  //////////////////////////
  // Update Triggers
  // Manual triggers instead of alarm on minute/second edges

  // Manually trigger SD logging on new minute
  if (minute() != lastMinute)
  {
    lastMinute = minute();
    trigger_logging = true;
  }

  // Manually trigger LCD refresh on new second
  if (second() != lastSecond)
  {
    lastSecond = second();
    trigger_lcd = true;
  }

  ///////////////////////////
  // Check Triggers
  // Called like this to avoid SPI bus collision between SD & LCD
  if (trigger_logging)
  {
    Serial.println("Trigger Button");
    recordData();
    delay(250);
    lcd.clear();
    if (SDCardExists)
      lcd.print("Data Logged");
    else
      lcd.print("No SD Card");
    delay(500);

    trigger_logging = false;
  }

  if (trigger_lcd)
  {
    // Serial.println("Trigger LCD");
    updateLCD();
    delay(10);

    trigger_lcd = false;
  }

  updateTemperatures(); // Updates every loop ~ 10Hz if delay below is 100
  delay(100);
}


