-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet_Chiller.ino
More file actions
32 lines (30 loc) · 1.65 KB
/
Set_Chiller.ino
File metadata and controls
32 lines (30 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ************************************************
// Set chiller state
// ************************************************
void Set_Chiller()
{
if (heat == 0) {
unsigned long chiller_currentMillis = millis();
if (chiller_currentMillis - chiller_previousMillis >= chiller_interval) { //pause 30 seconds between swtiching chiller on and off to prevent damage to chiller
chiller_previousMillis = chiller_currentMillis;
if (temp >= tempset + 0.05) { //if the observed temperature is greater than or equal the temperature setpoint plus .05 degree
Serial.println(F("chiller on")); //print chiller state to serial
digitalWrite(chiller, LOW);
}
if (temp <= tempset - 0.05) { //see if temperature is lower than .05 below setpoint
Serial.println(F("chiller off")); //print chiller state to serial
digitalWrite(chiller, HIGH);
}
}
}
if (heat == 1) {
if (temp <= tempset + 0.05) { //if the observed temperature is less than or equal the temperature setpoint plus .05 degree
Serial.println(F("chiller on")); //print chiller state to serial
digitalWrite(chiller, LOW);
}
if (temp >= tempset - 0.05) { //see if temperature is greater than or equal to .05 below setpoint
Serial.println(F("chiller off")); //print chiller state to serial
digitalWrite(chiller, HIGH);
}
}
}