     printData();                                         //print all readings to serial (line: 222)
     
     if(!ret){                                           //if sending failed
-      if(serial_state){
+      if(serial_state){                                 //check to see if serial bus is connected
         Serial.println("Data was not sent successfully!");
         Serial.println("-------------------------------------------------");
       }

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

int lightState;                     //to stores whether the light is turned on or off
int fanState;                       //to stores whether the fan is turned on or off
int heaterState;                    //to stores whether the heater is turned on or off

bool enable = true;                 //enable or disable automatic light control
float onReference  = 3.0;           //referenc voltage to turn light off if below it
