 void setup(){
 
   pinMode(busPin,INPUT);  // Designate temperature bus pin data direction
+  pinMode(heatPin,OUTPUT);                // Heat circuit relay 
+  pinMode(coolPin,OUTPUT);                // Cooling circuit relay
   Serial.begin(serialSpeed);
 
   sensors.begin();        // Start up the library. IC Default is 9 bit. If you have troubles consider upping it 12. Ups the delay

int numOfDevices = 1;             // How many sensors are in loop
int heat = 70;                    // This is the default heater trigger temp setting
int cool = 80;                    // This is the default cooling trigger temp setting
pinMode(7,OUTPUT);                // Heat circuit relay 
pinMode(8,OUTPUT);                // Cooling circuit relay
long currentTemp = 0.0;           // Current room temperature
int serialSpeed = 9600;           // Default serial comm speed
int tempSetpoint = 75;            // Default temperature setpoint on a reboot
boolean val;                      // Variable for user input
long oldTemp = 0;
unsigned long timeOut;            // Backlight timeout variable
boolean editable = FALSE;         // Determines whether or not button presses will do anything, used to avoid accidental changes
char* menu[] = {"Cooling", "Heating"};  // Menu display for either setting the high point or the low point of the temp range

// ----------------------------------------------------------------------------------------
void powerControl(){
  
  // TODO: Add in fan relay control


  // This executes if the heater is running and it gets warm enough to turn off.
  if (heatRunning && (currentTemp > (heat + buffer))) {
      heatRunning = FALSE;
      heatLastRan = millis();
      digitalWrite(heatPin,HIGH);
      return;
    }
  }

  // This executes if the AC is running and it gets cool enough to turn off
  if (coolRunning && (currentTemp < (cool - buffer))) {
      coolRunning = FALSE;
      coolLastRan = millis();
      digitalWrite(coolPin,HIGH);
      return;
    }
  }

  // This executes if it gets cold enough and the heater has not run for a minimum time (short cycle protection)
  if ((currentTemp < heat) && ((millis() - heatLastRan) > cycleTime) {
    digitalWrite(heatPin,HIGH);
    heatRunning = TRUE;
    return;
  }

  // This executes if it gets hot enough and the AC has not run for 10 minutes (short cycle protection)
  if ((currentTemp > cool) && ((millis() - coolLastRan) > 600000) {
    digitalWrite(coolPin,HIGH);
    coolRunning = TRUE;
    return;
  }

  return;
}


