 
 //--------------------------------------*****************************************************************
   else if (strcmp(data , "tempReference") == 0) {             //incoming message indicate that Rpi wants to set light reference to a new value, do the same as before
-    if(serial_state){
+    if(serial_state){                                         //check to see if serial bus is connected
       Serial.println("entering temp ref");
       Serial.println("---------------------------------------");
     }

}

void printData(){                                                 //print data (readings) to serial (for debugging)
    if(!serial_state){
      return;
    }
    Serial.println("-------------------------------------------------");
    Serial.print("Photo Resistor Voltage: ");

    SW.reset();
    
    if(timeout){
      if(serial_state){                                             //check to see if serial bus is connected
        Serial.println("Timeout, no incoming data");               //print error message and then retry sending data
        Serial.println("---------------------------------------");
      }
