   //Initialize SD card reader
   Serial.print("Initializing SD card...");
 
-  if (!SD.begin(chipSelect)) {
+  while (!SD.begin(chipSelect)) {
 
     Serial.println("Card failed, or not present");
     return;

byte received_from_sensor = 0; // How many characters have been received.
byte string_received = 0; // Whether it received a string from the EC circuit.

void setup () {

  // comment the following three lines out for final deployment
#ifndef ESP8266
  while (!Serial);   //for Leonardo/Micro/Zero
#endif

  Serial.begin(9600);


const int chipSelect = 4; //sets chip select pin for SD card reader

/* This integer specifies how high accuracy you want your pressure sensor to be (oversampling resolution).
 * Ok values: 256, 512, 1024, 2048, or 4096 (Higher = more accuracy but slower sampling frequency**)
 * ** There is no reason not to use the highest accuracy. This is because the datalogging rate is set by the
 * sampling/response frequency of the ec sensor [default = 1 sec] (this is to avoid the case where both sensors send data at the same time). */
#define PRESSURE_SENSOR_RESOLUTION 4096
MS_5803 sensor = MS_5803(PRESSURE_SENSOR_RESOLUTION); // Define pressure sensor.

OneWire oneWire(6); // Define the OneWire port for temperature.
DallasTemperature sensors(&oneWire); //Define DallasTemperature input based on OneWire.
