Sorry for the delay it would not allow me to post again since I am new. Also I cant seem to load all the code at one time. I removed the tft screen stuff
#include <TFT.h> // Hardware-specific library
#include <SPI.h>
#define CS 10
#define DC 8
#define RESET 9
TFT myScreen = TFT(CS, DC, RESET);
// Initialize outputs:
const int HPRev = 22; //GSHP Reversing Valve on when Ecobee set to cool
const int HPY1 = 23; //Main Area Heat or Cool Stage 1
const int HPY2 = 24; //Main Area Heat or Cool Stage 2
const int HPF = 25; //GSHP Fan commanded by Ecobee
const int HPDH = 26; //GSHP Dehumid commanded by Ecobee
const int Boil = 27; //Lochinvar Boil run command
//const int FFHP =28; //no longer used Ecobee will do floor and air handler in main area
const int MBFHP = 29; //Master Bed Floor Heat Pump
const int MBGFHP = 30; //Master bath and garage bath circulator pump
const int GBFHV = 31; //On manifold valve for garage bath
const int MBFHV = 32; //On manifold valve for Master Bath
const int HPCirc = 33; //Ground Source Heat Pump (Source water pumps)
const int MFLCirc = 34; // Main Area Floor Heat Circ Pump
const int AHCirc = 35; //Plenum Heat Xchanger Circ Pump
// Intialize Inputs:
const int EcoRev = 41; //Ecobee reversing valve
const int EcoF = 42; //Ecobee Fan
const int EcoY1 = 43; //Ecobee Y1 call for heat (main floor heat) or AC stage 1
const int EcoY2 = 44; //Ecobee Y2 call for heat (Y1 and Y2 on Air Handler Heat on) and Cool (Y1 and Y2 on Stage 2 cooling)
const int EcoDH = 45; //Ecobee Dehumid Call
//const int FFHCall = 46; // no longer used Ecobee will do floor and air handler in main area
const int MBedFHCall = 47; //Bed room floor heat call (includes master bed, upstairs spare bed, hallway, and hall bath
const int MBathFHCall = 48; //Master bathroom call for floor heat
const int GBFHCall = 40; //garage bathroom call for floor heat
//Changed garage bath call to 40 to troubleshoot
// Variables that will change:
int EcoRevState = 0;
int EcoFState = 0;
int EcoY1State = 0;
int EcoY2State = 0;
int EcoDHState = 0;
int MBedFHCallState = 0;
int MBathFHCallState = 0;
int GBFHCallState = 0;
int BoilState = 0;
int lastEcoRevState = 0; // previous state of the button
unsigned long previousMillis = 0;
unsigned long MBAirHand = 10000;
void setup(){
myScreen.begin();
myScreen.background(0,0,0); // clear the screen
myScreen.stroke(255,0,255);
// static text
myScreen.text("680 Fairview HVAC",0,0);
// increase font size for text in loop()
//Drive all relays to High to begin
digitalWrite(HPRev, HIGH);
digitalWrite(HPY1, HIGH);
digitalWrite(HPY2, HIGH);
digitalWrite(HPF, HIGH);
digitalWrite(HPDH, HIGH);
digitalWrite(Boil, HIGH);
//digitalWrite(FFHP, HIGH); // no longer used Ecobee will do floor and air handler in main area
digitalWrite(MBFHP, HIGH);
digitalWrite(MBGFHP, HIGH);
digitalWrite(GBFHV, HIGH);
digitalWrite(MBFHV, HIGH);
digitalWrite(HPCirc, HIGH);
digitalWrite(MFLCirc, HIGH);
digitalWrite(AHCirc, HIGH);
pinMode(HPRev, OUTPUT);
pinMode(HPY1, OUTPUT);
pinMode(HPY2, OUTPUT);
pinMode(HPF, OUTPUT);
pinMode(HPDH, OUTPUT);
pinMode(Boil, OUTPUT);
//pinMode(FFHP, OUTPUT); //no longer used Ecobee will do floor and air handler in main area
pinMode(MBFHP, OUTPUT);
pinMode(MBGFHP, OUTPUT);
pinMode(GBFHV, OUTPUT);
pinMode(MBFHV, OUTPUT);
pinMode(HPCirc, OUTPUT);
pinMode(MFLCirc, OUTPUT);
pinMode(AHCirc, OUTPUT);
// Pin Inputs to Inputs:
pinMode(EcoRev, INPUT_PULLUP);
pinMode(EcoF, INPUT_PULLUP);
pinMode(EcoY1, INPUT_PULLUP);
pinMode(EcoY2, INPUT_PULLUP);
pinMode(EcoDH, INPUT_PULLUP);
//pinMode(FFHCall, INPUT_PULLUP); //no longer used Ecobee will do floor and air handler in main area
pinMode(MBedFHCall, INPUT_PULLUP);
pinMode(MBathFHCall, INPUT_PULLUP);
pinMode(GBFHCall, INPUT_PULLUP);
}
void loop()
{
EcoRevState = digitalRead(EcoRev);
EcoY1State = digitalRead(EcoY1);
EcoY2State = digitalRead(EcoY2);
EcoFState = digitalRead(EcoF);
EcoDHState = digitalRead(EcoDH);
MBedFHCallState = digitalRead(MBedFHCall);
MBathFHCallState = digitalRead(MBathFHCall);
GBFHCallState = digitalRead(GBFHCall);
BoilState = digitalRead(Boil);
//mainfloorheat();
forcedairheat();
masterbedroomfloor();
masterbathfloor();
garagebathfloor();
tftscreen();
}
void tftscreen(){
//void mainfloorheat(){
//Ecobee Heat
//Heat Stage 1
//if (EcoRevState == HIGH && EcoY1State == LOW && EcoY2State == HIGH){
//digitalWrite(Boil, LOW); //turn boiler on
//digitalWrite(MFLCirc, LOW); //turn main circulator on
// }
// else {
// digitalWrite(Boil, HIGH); //turn off boiler
// digitalWrite(MFLCirc, HIGH); //turn off main floor circulator
//}
//}
void forcedairheat(){
//Ecobee Heat Forced Air stage 2
//Changed EcoY2State=LOW to HIGH, so that Y1 will call for forced air heat
if (EcoRevState == HIGH && EcoY1State == LOW && EcoY2State == HIGH){
digitalWrite(AHCirc, LOW); //turn air handler circulating pump on
digitalWrite(Boil, LOW); //turn boiler on
digitalWrite(HPF, LOW); //turn air handler fan on
//turn off floor heat to accomidate air handler
digitalWrite(MFLCirc, HIGH); //turn off main floor circ
digitalWrite(MBFHP, HIGH); //turn off the bedroom floor circ
}
else if (MBedFHCallState == LOW && EcoY2State == HIGH) {
}
else {
digitalWrite(AHCirc, HIGH);
digitalWrite(Boil, HIGH);
digitalWrite(HPF, HIGH);
}
}
void masterbedroomfloor(){
if (MBedFHCallState == LOW && EcoY2State == HIGH){ // this means there is a call for bedroom area floor heat but not a call for forced air heat by the EcoBee
digitalWrite(Boil, LOW); //turn boiler on
digitalWrite(MBFHP, LOW); //turn on the bedroom floor pump
}
else if (EcoRevState == HIGH && EcoY1State == LOW && EcoY2State == HIGH){
}
else {
digitalWrite(MBFHP, HIGH); //turn off the bedroom floor pump
digitalWrite(Boil, HIGH); //turn boiler off
}
}
void masterbathfloor(){
// Master bath floor heat call
if (MBathFHCallState = LOW){
digitalWrite(MBGFHP, LOW);
digitalWrite(MBFHV, LOW);
}
else if (GBFHCallState, LOW){
digitalWrite(MBGFHP, LOW);
digitalWrite(MBFHV, HIGH);
}
else {
digitalWrite(MBGFHP, HIGH);
digitalWrite(MBFHV, HIGH);
}
}
void garagebathfloor(){
if (GBFHCallState = LOW){
digitalWrite(MBGFHP, LOW);
digitalWrite(GBFHV, LOW);
}
else if (MBathFHCallState = LOW){
digitalWrite(MBGFHP, LOW);
digitalWrite(GBFHV, HIGH);
}
else{
digitalWrite(MBGFHP, HIGH);
digitalWrite(GBFHV, HIGH);
}
}