///////////////////////////////////////////////////////////////////////////////////////////////
//REMINDER * DHTTYPE DHT22 to DHT11
// * relay_is_inverted to HIGH
// * back_to_on_delay to 120 seconds
//
//
// // temp_coefficent = 4 works for my setup - change to code below
// // for NTC thermistor
// const float BETA = 3950; // should match the Beta Coefficient of the thermistor
// int analogValue = analogRead(A0);
// float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
//
///////////////////////////////////////////////////////////////////////////////////////////////
#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
#include <ESP32Servo.h>
#define DHTPIN 14
#define DHTTYPE DHT22
#define e_SIZE 256
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16,2);
byte purge_pin = 25;
byte Humidity_down_pin = 34; //pin for the humidity down button
byte timer_pin = 35; //pin for the timer dry button
byte on_off_button = 15; //pin for the on/off button
byte Heaterandfanpin = 12; //pin for the heater and fan output
byte buzzerPin = 23; //pin for the buzzer
int defaulthumiditytarget = 50; //default humidity target in celcius
int min_humidity_target = 10; //minimum humidity target in celcius
unsigned long dry_timer = 30; //timer mode dry time in minutes
int alarm_temp = 50; //alarm temperature
bool state_changed = HIGH; // set HIGH to start in OFF state, low to start in dehumidify state
const int servoPin = 18; //servo attatched to this pin
int thermistor_pin = 26; //Thermistor is on this pin
byte pump_pin = 27; //pump relay is on this pin
//Defaults - changes to values saved in eeprom
//reverts to defaults if max_temp < 1
int max_temp = 45; //max temperature able to set
int temp_lag = 5; //wait for temp to drop this value before trning on
unsigned long back_to_on_delay = 15; //seconds to wait to switch back on to (compressor)
unsigned long backlight_timeout = 5; //timout in minutes
bool Default_to_prev_humidity = LOW; //HIGH - revert to previous humidity, LOW - revert to off
bool relay_is_inverted = LOW; //set to high if relay output is inverted
unsigned long Main_timeout = 4; //main timout in hours
int max_motor_temp = 30; //switch off for overheat protection
unsigned long purge_delay = 5; //second to wait before purging
unsigned long purge_period = 2; //seconds to keep the relay/solenoid open
//////////////////////////////////////////////////////////////////////
//dont edit below//dont edit below//dont edit below//dont edit below//
//////////////////////////////////////////////////////////////////////
//saved in eeprom
int e_max_temp;
int e_temp_lag;
unsigned long e_back_to_on_delay;
unsigned long e_backlight_timeout;
bool e_Default_to_prev_humidity;
bool e_relay_is_inverted;
unsigned long e_Main_timeout;
int e_max_motor_temp;
unsigned long e_purge_delay;
unsigned long e_purge_period;
Servo servo;
byte mode = 0;
int savedtemp = 0;
int savedhum = 0;
bool on_off_state = LOW;
int newhumiditytarget = 50; //default humidity target
bool refresh = HIGH;
int before_timer_humidity = 30;
bool timer_already_tripped = HIGH;
int temperature = 10;
int humidity = 10;
bool on_off_pressed_once = LOW;
bool buzzer_state = LOW;
bool purge = LOW;
bool high_temp_state = HIGH;
unsigned long dehumidify_time1 ; //counter to check
unsigned long dehumidify_time2 ; //counter to check
unsigned long saved_dehumidify_time2 ;
bool already_in_mode_0;
bool already_in_mode_1;
bool already_in_mode_2;
bool already_in_mode_3;
bool Humidity_down_pin_state = LOW;
unsigned long time1 ; //couter to check
unsigned long time2 ; //counter to check
unsigned long time3 ; //time1 - time2
unsigned long time4 = 300; //click check maximum for click, minimum for long click
unsigned long any_button_timer ; //couter to check
unsigned long back_to_on_delay_timer; //mark switched off state to prevent turn on too soon
int temp_coefficent = 4;
int thermistor_value;
int pos = 0;
bool overheat_state = LOW;
void setup() {
Serial.begin(9600);
dht.begin();
lcd.init();
lcd.backlight();
pinMode(18, OUTPUT);
analogReadResolution(10);
servo.attach(servoPin, 500, 2400);
pinMode(on_off_button, INPUT);
pinMode(Humidity_down_pin, INPUT);
pinMode(timer_pin, INPUT);
pinMode(Heaterandfanpin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(purge_pin, OUTPUT);
pinMode(pump_pin, OUTPUT);
digitalWrite(Heaterandfanpin, relay_is_inverted); //TURN OFF
digitalWrite(purge_pin, relay_is_inverted); //TURN OFF
digitalWrite(pump_pin, relay_is_inverted); //TURN OFF
EEPROM.begin(e_SIZE);
EEPROM.get(10, e_max_temp);
EEPROM.get(20, e_temp_lag);
EEPROM.get(30, e_back_to_on_delay);
EEPROM.get(40, e_backlight_timeout);
EEPROM.get(50, e_Main_timeout);
EEPROM.get(60, e_Default_to_prev_humidity);
EEPROM.get(70, e_relay_is_inverted);
EEPROM.get(80, e_max_motor_temp);
EEPROM.get(90, e_purge_delay);
EEPROM.get(100, e_purge_period);
if(e_max_temp > 0){
max_temp = e_max_temp;
temp_lag = e_temp_lag;
back_to_on_delay = e_back_to_on_delay;
backlight_timeout = e_backlight_timeout;
Main_timeout= e_Main_timeout;
Default_to_prev_humidity = e_Default_to_prev_humidity;
relay_is_inverted = e_relay_is_inverted;
max_motor_temp = e_max_motor_temp;
purge_delay = e_purge_delay;
purge_period = e_purge_period;
}
}
void loop() {
temperature = dht.readTemperature();
humidity = dht.readHumidity();
thermistor_value = (analogRead(thermistor_pin)/temp_coefficent);
//Read on off button
if(digitalRead(on_off_button) == LOW && on_off_pressed_once == LOW){
on_off_pressed_once = HIGH;
lcd.backlight();
any_button_timer = millis();
time1 = millis();
state_changed = LOW;
delay(50);
}
if(digitalRead(on_off_button) == HIGH && on_off_pressed_once == HIGH){
on_off_pressed_once = LOW;
time2 = millis();
delay(50);
time3 = time2 - time1; // DEFINITION OF time3 - DONT CHANGE THIS - for click and long click
}
//put into menu mode if long click
if(time3 < time4 && state_changed == LOW){
state_changed = HIGH;
refresh = HIGH;
if(mode >= 4 && mode <= 14){
mode = mode + 1;
}
if(mode > 14){ // mode == 14 // reminder to find this when adding a new menu option
mode = 4;
}
}
//power off after main timer
if(millis() - any_button_timer >= Main_timeout*60000*60){
mode = 0;
}
//Backlight timeout
if(millis() - any_button_timer >= backlight_timeout*60000){
lcd.noBacklight();
}
//reset to mode 0 from mode 1, 2 or 3
if(digitalRead(on_off_button) == LOW && (mode == 1 || mode == 2 || mode == 3)){
mode = 0;
refresh = HIGH;
}
//menu - put into menu mode
if(time3 > time4 && state_changed == LOW && on_off_pressed_once == LOW){
state_changed = HIGH;
refresh = HIGH;
if(mode >= 0 && mode <=3){
mode = 4;
}
else if( mode >=4){
mode = 0;
}
}
//Refresh dislay if TEMPERATURE value change
if(savedtemp < temperature || savedtemp > temperature){
savedtemp = temperature;
refresh = HIGH;
}
//Refresh dislay if HUMIDITY value change
if(savedhum < humidity || savedhum > humidity){
savedhum = humidity;
refresh = HIGH;
}
//LOW TEMPSTATE WHAT TO DO IN LOW TEMP STATE
if(temperature <= max_temp){
if(high_temp_state != LOW){
high_temp_state = LOW;
}
if(temperature <= max_temp - temp_lag){
if(humidity > newhumiditytarget){
if (mode != 0){
if(millis() - back_to_on_delay_timer > back_to_on_delay*1000 && on_off_state == LOW){
on_off_state = HIGH;
digitalWrite(Heaterandfanpin, !relay_is_inverted); //TURN ON
// for loop that decreases the angle by 1 from 180 to 0 with a delay of 10 ms per angle
for (pos = 180; pos >= 0; pos -= 1) {
servo.write(pos);
delay(10);
}
refresh = HIGH;
}
}
}
}
}
//HIGH TEMPSTATE WHAT TO DO IN HIGH TEMP STATE
else if(temperature > max_temp && high_temp_state == LOW){
high_temp_state = HIGH;
digitalWrite(Heaterandfanpin, relay_is_inverted); //TURN OFF
// for loop that increases the angle by 1 from 0 to 180 with a delay of 10 ms per angle
for (pos = 0; pos <= 180; pos += 1) {
servo.write(pos);
delay(10);
}
on_off_state = LOW;
back_to_on_delay_timer = millis();
refresh = HIGH;
}
//ALARM STATE
if(temperature >= alarm_temp){
tone(buzzerPin, 2300);
on_off_state = LOW;
delay(100);
buzzer_state = HIGH;
} else if(temperature < max_temp && buzzer_state == HIGH){
buzzer_state = LOW;
noTone(buzzerPin);
}
//COMPRESSOR PROBE - OVERHEAT
if(thermistor_value > max_motor_temp && mode != 0 && overheat_state == LOW){
overheat_state = HIGH;
mode = 0;
}
else if(overheat_state == HIGH){
overheat_state = LOW;
refresh = HIGH;
}
//PURGE
if(purge == HIGH){
purge = LOW;
lcd.setCursor(0,0);
lcd.print("DEFROSTING ");
digitalWrite(purge_pin, !relay_is_inverted);
delay(purge_period*1000);
digitalWrite(purge_pin, relay_is_inverted);
delay(purge_period*1000);
lcd.setCursor(0,0);
lcd.print("PURGING WATER ");
digitalWrite(pump_pin, !relay_is_inverted);
delay(purge_period*500);
digitalWrite(pump_pin, relay_is_inverted);
refresh = HIGH;
}
//MODE 0 - OFF
if(mode == 0 && already_in_mode_0 == LOW){
already_in_mode_0 = HIGH;
already_in_mode_1 = LOW;
already_in_mode_2 = LOW;
already_in_mode_3 = LOW;
digitalWrite(Heaterandfanpin, relay_is_inverted); //TURN OFF
lcd.setCursor(0,0);
lcd.print("CLOSING DAMPENER");
// for loop that increases the angle by 1 from 0 to 180 with a delay of 10 ms per angle
for (pos = 0; pos <= 180; pos += 1) {
servo.write(pos);
delay(10);
}
on_off_state = LOW;
back_to_on_delay_timer = millis();
newhumiditytarget = defaulthumiditytarget;
timer_already_tripped = HIGH;
lcd.setCursor(0,0);
lcd.print("PURGE DELAY ");
delay(purge_delay*1000);
purge = HIGH;
refresh = HIGH;
}
//MODE 1 - STANDBY
if(mode == 1){
//GO TO MODE 2 IF HIGH HUMIDITY
if(humidity > newhumiditytarget){
mode = 2;
}
if(already_in_mode_1 == LOW){
already_in_mode_0 = LOW;
already_in_mode_1 = HIGH;
already_in_mode_2 = LOW;
already_in_mode_3 = LOW;
digitalWrite(Heaterandfanpin, relay_is_inverted); //TURN OFF
lcd.setCursor(0,0);
lcd.print("CLOSING DAMPENER");
// for loop that increases the angle by 1 from 0 to 180 with a delay of 10 ms per angle
for (pos = 0; pos <= 180; pos += 1) {
servo.write(pos);
delay(10);
}
on_off_state = LOW;
back_to_on_delay_timer = millis();
lcd.setCursor(0,0);
lcd.print("PURGE DELAY ");
delay(purge_delay*1000);
purge = HIGH;
refresh = HIGH;
}
}
//DEHUMIDIFYING BUTTON
if (digitalRead(Humidity_down_pin) == LOW && Humidity_down_pin_state == LOW){
Humidity_down_pin_state = HIGH;
lcd.backlight();
any_button_timer = millis();
refresh = HIGH;
//PUT INTO MODE 2
if(mode == 0 || mode == 3){
mode = 2;
newhumiditytarget = defaulthumiditytarget;
}
else if(mode == 1 || mode == 2){
//REDUCE TARGET HUMIDITY - ONLY IF IN MODE 1 OR 2
if(newhumiditytarget > min_humidity_target){ //if the humidity above min humidity
newhumiditytarget = newhumiditytarget - 5; //subtract 5%
}
//GO BACK TO DEFAULT HUMIDITY
else {
newhumiditytarget = defaulthumiditytarget; //otherwise reset to default min
}
}
delay(50);
}
else if(digitalRead(Humidity_down_pin) == HIGH && Humidity_down_pin_state == HIGH){
Humidity_down_pin_state = LOW;
delay(50);
}
//MODE 2 - ACTION - MAINLY TRIGGER TURN ON RELAY AND RESET TIMER
if(mode == 2){
//GO TO MODE 1 IF LOW HUMIDITY
if(humidity < newhumiditytarget){
mode = 1;
}
if(already_in_mode_2 == LOW){
already_in_mode_0 = LOW;
already_in_mode_1 = LOW;
already_in_mode_2 = HIGH;
already_in_mode_3 = LOW;
if(temperature < max_temp){
if(millis() - back_to_on_delay_timer > back_to_on_delay*1000 && on_off_state == LOW){
on_off_state = HIGH;
digitalWrite(Heaterandfanpin, !relay_is_inverted); //TURN ON
lcd.setCursor(0,0);
lcd.print("OPENING DAMPENER");
// for loop that decreases the angle by 1 from 180 to 0 with a delay of 10 ms per angle
for (pos = 180; pos >= 0; pos -= 1) {
servo.write(pos);
delay(10);
}
}
}
timer_already_tripped = LOW;
refresh = HIGH;
delay(500);
}
}
//MODE 3 - TRIGGER TIMER ON BUTTON PRESS
if(digitalRead(timer_pin) == LOW && (mode == 0 || mode == 1 || mode == 2 || mode == 3)){
mode = 3;
lcd.backlight();
any_button_timer = millis();
on_off_pressed_once = LOW;
already_in_mode_0 = LOW;
dehumidify_time1 = millis();
timer_already_tripped = LOW;
saved_dehumidify_time2 = 0;
if(temperature < max_temp){
if(millis() - back_to_on_delay_timer > back_to_on_delay*1000 && on_off_state == LOW){
digitalWrite(Heaterandfanpin, !relay_is_inverted); //TURN ON
// for loop that decreases the angle by 1 from 180 to 0 with a delay of 10 ms per angle
for (pos = 180; pos >= 0; pos -= 1) {
servo.write(pos);
delay(10);
}
on_off_state = HIGH;
}
}
if(newhumiditytarget != 0){
before_timer_humidity = newhumiditytarget;
newhumiditytarget = 0;
refresh = HIGH;
}
}
//MODE 3
if(mode == 3){
//RESET OTHER MODES
if(already_in_mode_3 == LOW){
already_in_mode_0 = LOW;
already_in_mode_1 = LOW;
already_in_mode_2 = LOW;
already_in_mode_3 = HIGH;
}
//TIMER TIMING
dehumidify_time2 = millis() - dehumidify_time1;
if(dehumidify_time2 >= saved_dehumidify_time2 + 1000){
saved_dehumidify_time2 = dehumidify_time2;
}
//TIMER EXPIRED
if(dehumidify_time2 >= dry_timer*60000 && timer_already_tripped == LOW){
timer_already_tripped = HIGH;
newhumiditytarget = before_timer_humidity; // restore to prev humidity target
refresh = HIGH;
if(Default_to_prev_humidity == HIGH){
mode = 2;
}
else{
mode = 0;
on_off_state = LOW;
}
}
}
//MODE 4 - MENU - change max temp
if (mode == 4){
if(digitalRead(Humidity_down_pin) == LOW){
max_temp = max_temp + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
max_temp = max_temp - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 5 - MENU - change max temp
if (mode == 5){
if(digitalRead(Humidity_down_pin) == LOW){
temp_lag = temp_lag + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
temp_lag = temp_lag - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 6 - MENU - change switch on delay
if (mode == 6){
if(digitalRead(Humidity_down_pin) == LOW){
back_to_on_delay = back_to_on_delay + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
back_to_on_delay = back_to_on_delay - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 7 - MENU - change backlight timeout
if(mode == 7){
//increments of 1
if(backlight_timeout >= 0 && backlight_timeout < 10){
if(digitalRead(Humidity_down_pin) == LOW){
backlight_timeout = backlight_timeout + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
backlight_timeout = backlight_timeout - 1;
refresh = HIGH;
delay(500);
}
}
//increments of 10
else if(backlight_timeout >= 10){
if(digitalRead(Humidity_down_pin) == LOW){
backlight_timeout = backlight_timeout + 10;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
backlight_timeout = backlight_timeout - 10;
refresh = HIGH;
delay(500);
}
}
}
//MODE 8 - MENU - change main timeout period (the long one)
if(mode == 8){
if(digitalRead(Humidity_down_pin) == LOW){
Main_timeout = Main_timeout + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW && Main_timeout > 1){
Main_timeout = Main_timeout - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 9 - MENU - change the default timeout behaviour
if(mode == 9){
if(digitalRead(Humidity_down_pin) == LOW){
Default_to_prev_humidity = LOW;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW && Main_timeout > 1){
Default_to_prev_humidity = HIGH;
refresh = HIGH;
delay(500);
}
}
//MODE 10 - MENU - change the output relay inversion
if(mode == 10){
if(digitalRead(Humidity_down_pin) == LOW){
relay_is_inverted = LOW;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
relay_is_inverted = HIGH;
refresh = HIGH;
delay(500);
}
}
//MODE 11 - MENU - OVERHEAT TEMP
if(mode == 11){
if(digitalRead(Humidity_down_pin) == LOW){
max_motor_temp = max_motor_temp + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
max_motor_temp = max_motor_temp - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 12 - MENU - PURGE DELAY
if(mode == 12){
if(digitalRead(Humidity_down_pin) == LOW){
purge_delay = purge_delay + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
purge_delay = purge_delay - 1;
refresh = HIGH;
delay(500);
}
}
//MODE 13 - MENU - PURGE DELAY
if(mode == 13){
if(digitalRead(Humidity_down_pin) == LOW){
purge_period = purge_period + 1;
refresh = HIGH;
delay(500);
}
if(digitalRead(timer_pin) == LOW){
purge_period = purge_period - 1;
refresh = HIGH;
delay(500);
}
}
//MODE == 14 - MENU - save to eeprom
if(mode == 14){
if(digitalRead(Humidity_down_pin) == LOW){
for (int i = 0; i < 512; i++) {
EEPROM.write(i, 0);
}
EEPROM.commit();
delay(500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("EEPROM WIPED!");
EEPROM.put(10, max_temp);
EEPROM.commit();
delay(100);
EEPROM.put(20, temp_lag);
EEPROM.commit();
delay(100);
EEPROM.put(30, back_to_on_delay);
EEPROM.commit();
delay(100);
EEPROM.put(40, backlight_timeout);
EEPROM.commit();
delay(100);
EEPROM.put(50, Main_timeout);
EEPROM.commit();
delay(100);
EEPROM.put(60, Default_to_prev_humidity);
EEPROM.commit();
delay(100);
EEPROM.put(70, relay_is_inverted);
EEPROM.commit();
delay(100);
EEPROM.put(80, max_motor_temp);
EEPROM.commit();
delay(100);
EEPROM.put(90, purge_delay);
EEPROM.commit();
delay(100);
EEPROM.put(100, purge_period);
EEPROM.commit();
delay(100);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SAVED TO EEPROM!");
delay(2000);
mode = 0;
already_in_mode_0 = LOW;
refresh = HIGH;
}
}
//LCD
if(refresh == HIGH){
lcd.clear();
refresh = LOW;
//WAIT FOR THE PURGE BEFORE REFRESHING
if(purge == LOW){
if(mode == 0){
lcd.setCursor(0,0);
lcd.print("OFF");
if(thermistor_value > max_motor_temp){
lcd.print(" - OVERHEATED");
}
lcd.setCursor(0,1);
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C");
if(temperature > max_temp){
lcd.print("!");
}
lcd.setCursor(8,1);
lcd.print(humidity);
lcd.print("%");
}
if(mode == 1){
lcd.setCursor(0,0);
lcd.print("STANDBY");
lcd.setCursor(0,1);
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C");
if(temperature > max_temp){
lcd.print("!");
}
lcd.setCursor(8,1);
lcd.print(humidity);
lcd.print("%");
lcd.print((char)126);
lcd.print(newhumiditytarget);
lcd.print("%");
}
if(mode == 2){
lcd.setCursor(0,0);
lcd.print("DRYING FILAMENT");
lcd.setCursor(0,1);
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C");
if(temperature > max_temp){
lcd.print("!");
}
if(millis() - back_to_on_delay_timer < back_to_on_delay*1000){
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,0);
lcd.print("DRYING - WAIT ");
}
lcd.setCursor(8,1);
lcd.print(humidity);
lcd.print("%");
lcd.print((char)126);
lcd.print(newhumiditytarget);
lcd.print("%");
}
if(mode == 3){
lcd.setCursor(0,0);
lcd.print("TIMER");
lcd.setCursor(8,0);
lcd.print(dry_timer - dehumidify_time2/60000);
lcd.print(" min");
lcd.setCursor(0,1);
lcd.print(temperature);
lcd.print((char)223);
lcd.print("C");
if(temperature > max_temp){
lcd.print("!");
}
lcd.setCursor(8,1);
lcd.print(humidity);
lcd.print("%");
lcd.print((char)126);
lcd.print(newhumiditytarget);
lcd.print("%");
}
if(mode == 4){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("MAX TEMP");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(max_temp);
lcd.print((char)223);
lcd.print("C");
}
if(mode == 5){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("TEMP LAG");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(temp_lag);
lcd.print((char)223);
lcd.print("C");
}
if(mode == 6){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("ON DELAY");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(back_to_on_delay);
lcd.print(" SECONDS");
}
if(mode == 7){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("LIGHT TIMEOUT");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(backlight_timeout);
if(backlight_timeout == 1){
lcd.print(" MINUTE");
}
else{
lcd.print(" MINUTES");
}
}
if(mode == 8){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("MAIN TIMEOUT");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(Main_timeout);
if(Main_timeout == 1){
lcd.print(" HOUR");
}
else{
lcd.print(" HOURS");
}
}
if(mode == 9){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("TIME END INTO");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
if(Default_to_prev_humidity == HIGH){
lcd.print("DEHUMIDIFY");
}
else{
lcd.print("OFF MODE");
}
}
if(mode == 10){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("RELAY MODE");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
if(relay_is_inverted == HIGH){
lcd.print("INVERTED");
}
else{
lcd.print("NORMAL");
}
}
if(mode == 11){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("OVERHEAT TEMP ");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(max_motor_temp);
lcd.print((char)223);
lcd.print("C");
}
if(mode == 12){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("PURGE DELAY ");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(purge_delay);
lcd.print(" SECONDS");
}
if(mode == 13){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("PURGE PERIOD ");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(1,1);
lcd.print(purge_period);
lcd.print(" SECONDS");
}
if(mode == 14){
lcd.setCursor(0,0);
lcd.print((char)127);
lcd.print("SAVE TO EEPROM");
lcd.setCursor(15,0);
lcd.print((char)126);
lcd.setCursor(0,1);
lcd.print("LONGCLICK = EXIT");
}
}
}
}
LOWERS THE HUMIDITY TARGET BY 5%
SETS 30 MIN TIMER @ 0% HUMIDTY
(RESETS TO PREVIOUS HUMIDITY TARGET)
ON/OFF
AIR INLET DAMPENER
PURGE RELAY
MAIN RELAY
PUMP