 
 //===================================Library Includes====================================
 #include <EEPROM.h>
-
+#include <SD.h>
+#include <SPI.h>
 //=====================================Definitions=======================================
 #define dataSetLength 6
 #define EEPROM_TIMEBASE_ADDR 0
 
 //===================================Program Settings====================================
-boolean mockMode = false;                    //  Defines which mode of operation to use.
-                                            //    - True denotes Mock Data Mode
-                                            //    - False denotes Data Acquistion Mode
+boolean mockMode = false;                  //  Defines which mode of operation to use.
+                                           //    - True denotes Mock Data Mode
+                                           //    - False denotes Data Acquistion Mode
 
 boolean sendConfigInfo = true;             //  This is an option to send an initial
-                                            //  set of configuration settings, giving
-                                            //  the plotting program more information
-                                            //  on what data it is handling.
+                                           //  set of configuration settings, giving
+                                           //  the plotting program more information
+                                           //  on what data it is handling.
 
 int configUpdateLimit = 10;                //  If config info strings are enabled,
                                            //  sets the maximum time elapsed before
                                            //  program should send an config update.
-
-boolean retainTimeReference = false;        //  This option reads and writes each time 
-                                           //  base value to EEPROM on each loop to
-                                           //  determine whether a reset has occured.
-                                           //  If reset occurs, then the stored value
-                                           //  is added to the newly generated execution
-                                           //  time.
                                            
-boolean xbeeMode = true;                  //  This condition determines whether Xbees
+boolean xbeeMode = false;                  //  This condition determines whether Xbees
                                            //  are being used. Usually this would be
                                            //  true, except for testing without the
                                            //  Xbee.
-
-int sigNum = 6;                           //  This allows quick changes to be made to
+                                           
+boolean SDMode = false;                    //  Condition to execute optional SD
+                                           //  functionality. This is provided for
+                                           //  testing purposes where the SD might
+                                           //  not be used.
+
+int sigNum = 6;                            //  This allows quick changes to be made to
                                            //  the number of signals when in mock mode,
                                            //  which helps with testing transmission 
                                            //  capacity.

    Serial.println("OK received. Configuration complete");
    
  }
  //~~~~~~~~~~~~~~~~~~~~~~~~~Wait for Information from Plotter~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /*int buff_length = 6;
  char xbee_buf[10]; 
  Serial2.print("+++");
  delay(1000);
  
  while(1) 
  {
    if(Serial2.available() > buff_length)
    {
      Serial2.readBytesUntil('\n', xbee_buf, Serial2.available());
      Serial.println(xbee_buf);
      delay(1000);
    }
    else if(Serial2.available())
    {
      Serial2.readBytesUntil('S', xbee_buf, Serial2.available());
      Serial.print("Else: ");
      Serial.println(xbee_buf);
      
    }
  }
  
 
  //while(Serial2.available()) Serial.write(Serial2.read());
  Serial.println("Waiting on start message...");
  while((!Serial2.available()) || (!Serial2.find("Start")));
  Serial.println("Start message received. Beginning transmission");
  */
  //~~~~~~~~~~~~~~~~~~~~~~~Send Initial Configuration Information~~~~~~~~~~~~~~~~~~~~~~~~
  sendConfigString();
  
  //~~~~~~~~~~~~~~~~~~~~~~~~Clear time reference if applicable~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if(!retainTimeReference)
  {
    EEPROM.write(EEPROM_TIMEBASE_ADDR, 0);  //  Set recorded time value to 0
    EEPROM.write(EEPROM_TIMEBASE_ADDR+1, 0);
    EEPROM.write(EEPROM_TIMEBASE_ADDR+2, 0);
  }
}



//=================================Main Program Loop=====================================
void loop() {

  float timeElapsed = 0;
  float addedTime = 0;
  if(mockMode)                              //  Enters mock data transmission mode
  {
    int ramp = 0; 

    }
    return;
}
