#include <SoftwareSerial.h>
#include <MemoryFree.h>
#include <Wire.h>
#include <EEPROM.h>
//#include <EEPROMex.h>
#include <SmoothAnalogInput.h>
#include <avr/pgmspace.h>
#include <FastIO.h>
#include <I2CIO.h>
#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_SR.h>
#include <LiquidCrystal_SR2W.h>
#include <LiquidCrystal_SR3W.h>
#include <ClickEncoder.h>
#include <TimerOne.h>
#define aref_voltage 3.3
#define THERMISTORNOMINAL 10000
#define TEMPERATURENOMINAL 25
#define BCOEFFICIENT 3950
#define SERIESRESISTOR 10000
SoftwareSerial
esp8266Module
(4,
5);
// RX, TX
int plnt0 = A0; //PLANTPUMP0
int plnt1 = A1; //PLANTPUMP1
int e1 = A2; //Error LED 1 WATER LEVEL
int temppin = A3; //TEMPERATURE SENSOR
//A4 A5 I2C D1 D2 RX TX
//2-3-7 ENCODER
int heater=11; //relay4 heater
int co2 = 12;
; //relay3 co2
int lcdbl = 6; //LCD BackLight
int wls = 8; //Water level switch
int LED = 9; //PWM RED LED
int fan = 10; //PWM YELLOW FAN!!! 10
int pump = 11; //relay1 external filter
int neon = 12; //relay2 T5 lights
int e2 = 13; //Temperature Error LED
Time t;
byte wlsv = LOW; //water level value
float tempHeaterMin = 24.5; //HEATER ON
float tempHeaterMax = 24.8; //HEATER OFF
float tempHeaterMinNight = 24.5; //HEATER ON
float tempHeaterMaxNight = 24.8; //HEATER OFF
int tempFanMin = 10600; //FAN speed min
int tempFanMax = 11100; //FAN speed max
byte tempLedHigh = 27; //TEMPLED Upper treshold
byte tempLedLow = 23; //TEMPLED Lower treshold
byte FANspeed; //FAN speed value
byte FANsz; //FAN speed LCD
byte neonv; //NEON ON-OFF value
unsigned long LEDv; //LED ON-OFF value
unsigned long LED_UPFADEON = 36000; //allminute 10.00
unsigned long LED_UPFADEMIDDLE = 37800; //allminute 10.30
unsigned long LED_UPFADEOFF = 39600; //allminute 11.00
unsigned long LED_DOWNFADEON = 75600; //allminute 21.00
unsigned long LED_DOWNFADEMIDDLE = 77400; //allminute 21.30
unsigned long LED_DOWNFADEOFF = 79200; //allminute 22.00
unsigned long eattime = 61200; //allminute 17.00 61200
unsigned long co2on = 30600; //8.30
unsigned long co2off =72000; //20.00
unsigned long plnt0time = 37800;
unsigned long plnt1time = 37810;
unsigned long allsec;
unsigned long hour;
unsigned long min;
unsigned long sec;
unsigned long date;
byte hourminute = 60;
byte leddisp; //LED value LCD
unsigned long previousMillisdisplay;
unsigned long previousMillistemp;
unsigned long previousMillistempz;
unsigned long previousMilliswlsv;
unsigned long previousMillispump;
unsigned long previousMillisplnt0;
unsigned long previousMillisplnt1;
unsigned long previousMilliswifi;
unsigned long previousMilliswifi2;
unsigned long timeoutTime = 5000;
unsigned long timeoutTime2 = 15000;
int waitsteinhart= 12000;
int previousvalue;
int menuTimeout = 5000;
int menuTimeout2 = 15000;
int intervaltemp = 1000;
int intervalwlsv = 5000;
int intervallcdbl = 600;
int startwifi = 20000;
unsigned long intervalpump = 4000;
const long intervalwifi = 7200000;
const long intervalwifi2 = 20000;
byte blinktime = 100;
float average1;
float steinhart;
byte offpump = 5;
unsigned long pumpofftime = 300000;
unsigned long plnt0ontime = 555; ///26,5ml - 30s 0,9/s 5ml/nap Macro 5555
unsigned long plnt1ontime = 250; /// 24ml - 30s 0,8/s 5ml/nap Carbo 2500
byte MoonPWMValue = 0;
byte DayLightPWMValue = 100;
//unsigned long uptimedays=0;
//unsigned long uptimehours=0;
//unsigned long uptimemins=0;
//unsigned long uptimesecs=0;
byte displayowr= 0;
byte EEPheater = 0;
byte EEPneon = 1;
byte EEPfan = 2;
byte EEPled = 3;
byte EEPco2 = 4;
byte EEPplnt0 = 5;
byte EEPplnt1 = 1;
//byte eepneon1 = 0;
//byte eepneon2 = 4;
//byte eepuptime = 8;
//float neon1oh;
//float neon2oh;
//float neon1ohmax;
//float neon2ohmax;
//float filterclean;
//float filtercleanmax;
//int uptimedayslast;
//float uptimecount;
//float neon1restart = 0;
//float neon2restart = 0;
//float uptimecountrestart = 0;
//float eepintervalhour = 0.1;
//unsigned long previousMillistube = 0;
//unsigned long previousMillisuptime = 0;
//unsigned long eepinterval1 = 360000;
//unsigned long eepinterval2 = 720000;
byte heaterv;
byte pumpv;
byte lastneonv;
byte co2v;
byte plnt0v;
byte plnt1v;
byte setupvalue = 0;
byte lastsetupvalue = 0;
byte heatercntrl;
byte lastheater;
byte fancntrl;
byte lastfan;
byte neoncntrl;
byte lastneon;
byte ledcntrl;
byte lastled;
byte plnt0cntrl = 0;
byte plnt1cntrl = 0;
byte co2cntrl = 0;
byte lastco2;
byte lastplnt0;
byte lastplnt1;
//byte lastplnt0lst = 0;
//byte lastplnt01st = 0;
byte feedcount = 1;
byte lcdbls = LOW;
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7); // 0x27 is the I2C bus address for an unmodified backpack
ClickEncoder *encoder;
int16_t last, value;
void timerIsr() {encoder->service();}
SmoothAnalogInput ai;
byte small2[8] = {
0b00000,
0b00000,
0b00000,
0b00110,
0b01001,
0b00010,
0b00100,
0b01111
};
String network = "****"; // your access point SSID
String password = "****"; // your wifi Access Point password
#define IP "184.106.153.149" // IP address of thingspeak.com
String GET = "GET /update?key=*********"; // replace with your channel key
void setup() { //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ai.attach(temppin);delay (5000);
Wire.begin();delay (2000);
Serial.begin(9600);delay (2000);
Serial.println("Reseting esp82661");
Serial.println("Reseting esp82662");
rtc.begin();
pinMode (plnt0, OUTPUT);
pinMode (plnt1, OUTPUT);
pinMode (neon, OUTPUT);
pinMode (co2, OUTPUT);
pinMode (heater, OUTPUT);
pinMode (pump, OUTPUT);
pinMode (LED, OUTPUT);
pinMode (wls, INPUT_PULLUP);
pinMode (fan, OUTPUT);
pinMode (e1, OUTPUT);
pinMode (e2, OUTPUT);
pinMode (temppin, INPUT);
pinMode (lcdbl, OUTPUT);
digitalWrite (pump, HIGH);
digitalWrite (heater, HIGH);
digitalWrite (LED, LOW);
digitalWrite (fan, LOW);
digitalWrite (lcdbl, HIGH);
digitalWrite (neon, HIGH);
digitalWrite (co2, HIGH);
lcd.begin (16,2); // for 16 x 2 LCD module
lcd.createChar(0, small2);
lcd.setBacklightPin(3,POSITIVE);
lcd.setBacklight(HIGH);
analogReference(EXTERNAL);
Serial.println("Reseting esp82663");
lcd.home();
/* lcd.print (" <Loading> "); lcd.setCursor (0,1);
lcd.print (" <CONTROLLER> "); delay(150);
lcd.home();
lcd.print (" < AQUARIUM > "); lcd.setCursor (0,1);
lcd.print (" < CONTROLLER > "); delay(150);
lcd.home();
lcd.print (" < AQUARIUM > "); lcd.setCursor (0,1);
lcd.print ("< CONTROLLER >"); delay(150);
lcd.home();
lcd.print ("< AQUARIUM >"); lcd.setCursor (0,1);
lcd.print (" CONTROLLER "); delay(150); */
lastheater = EEPROM.read(EEPheater);
lastneon = EEPROM.read(EEPneon);
lastfan = EEPROM.read(EEPfan);
lastled = EEPROM.read(EEPled);
lastco2 = EEPROM.read(EEPco2);
lastplnt0 = EEPROM.read(EEPplnt0);
lastplnt1 = EEPROM.read(EEPplnt1);
encoder = new ClickEncoder(2, 3, 7);
Timer1.initialize(1000);
Timer1.attachInterrupt(timerIsr); last = -1;
delay (2000);
//EEPROM.writeFloat(eepneon1, neon1restart);
//EEPROM.writeFloat(eepneon2, neon2restart);
//EEPROM.writeFloat(eepuptime, uptimecountrestart);
// The following lines can be uncommented to set the date and time
//rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(1, 07, 00); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(17, 6, 2016); // Set the date to January 1st, 2014ó nap hó év
}
void loop() {//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
String cmd = F("AT+CWJAP=\"");
cmd += network;
cmd += F("\",\"");
cmd += password;
cmd += F("\"");
Serial.println("Reseting esp82666");
if ((millis() < startwifi) || (millis() - previousMilliswifi >= intervalwifi)) { previousMilliswifi =millis();
Serial.
println("Reseting esp8266");
delay(100);
{Serial.println("Found OK");
Serial.println("Changing espmode");}
esp8266Module.
println(F
("AT+CWMODE=1"));
{Serial.println("Mode changed");}
else if(esp8266Module.
find("NO CHANGE")){
Serial.println("Already in mode 1");}
delay(100);
delay(20000);
{ Serial.println("Connected to Access Point");}
else
{Serial.println("Could not connect to Access Point");}
;}
pumpv = digitalRead (pump);
plnt0v = digitalRead (plnt0);
plnt1v = digitalRead (plnt1);
//idő--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
t = rtc.getTime();
hour = t.hour;
min = t.min;
sec = t.sec;
allsec = ((hour*60*60) + (min*60) + sec);
//neon1oh=EEPROM.readFloat(eepneon1);
//neon2oh=EEPROM.readFloat(eepneon2);
//uptimecount=EEPROM.readFloat(eepuptime);
/* uptimesecs = millis()/1000; //convect milliseconds to seconds
uptimemins=uptimesecs/60; //convert seconds to minutes
uptimehours=uptimemins/60; //convert minutes to hours
uptimedays=uptimehours/24; //convert hours to days
uptimesecs=uptimesecs-(uptimemins*60); //subtract the coverted seconds to minutes in order to display 59 secs max
uptimemins=uptimemins-(uptimehours*60); //subtract the coverted minutes to hours in order to display 59 minutes max
uptimehours=uptimehours-(uptimedays*24); //subtract the coverted hours to days in order to display 23 hours max */
//etetés------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if((allsec >= eattime) && (feedcount==0) && (allsec<LED_DOWNFADEOFF)){
unsigned long currentMillisdisplay = millis();
if (currentMillisdisplay - previousMillisdisplay >= intervallcdbl) {previousMillisdisplay = currentMillisdisplay;
if (lcdbls == LOW) {lcdbls = HIGH;} else {lcdbls = LOW;}
digitalWrite(lcdbl, lcdbls); displayowr=1; delay(200);}}
else {displayowr=0;}
if (allsec >=LED_DOWNFADEOFF){feedcount==0;}
if(displayowr==0) {if((value != previousvalue) || (setupvalue !=lastsetupvalue)) { timeoutTime = millis() + menuTimeout; timeoutTime2 = millis() + menuTimeout2; previousvalue=value; lastsetupvalue = setupvalue; }
if((allsec >= LED_UPFADEON) && (allsec <LED_DOWNFADEOFF)){ //nappal van
if (timeoutTime<millis()&& timeoutTime2>millis()) {analogWrite (lcdbl, 10);}
if (timeoutTime>millis()) {digitalWrite (lcdbl, HIGH);}
if (timeoutTime2<millis()) {analogWrite (lcdbl, 1); value=0; previousvalue=value; delay(500);}}
else {
if (timeoutTime<millis()&& timeoutTime2>millis()) {analogWrite (lcdbl, 5);}
if (timeoutTime>millis()) {analogWrite (lcdbl, 50);}
if (timeoutTime2<millis()) {analogWrite (lcdbl, 1); value=0; previousvalue=value; delay(500);}}}
//vízszint------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
wlsv = digitalRead(wls);
if (wlsv==LOW) {
if (millis() - previousMilliswlsv > intervalwlsv) {previousMilliswlsv = millis(); digitalWrite(e1, HIGH);}}
if (millis() - previousMilliswlsv > blinktime) {digitalWrite(e1, LOW);}
if (wlsv==HIGH) {digitalWrite(e1, LOW);}
//hőmérséklet---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
int sensorReading = ai.read();
average1 = sensorReading ;
average1 = 1023 / average1 - 1;
average1 = SERIESRESISTOR / average1;
steinhart = THERMISTORNOMINAL / average1 ; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart = steinhart - 273.5; // convert to C
//fűtés--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (wlsv == HIGH && waitsteinhart < millis()){if (lastheater==0){ (heatercntrl=0);
if((allsec >= LED_UPFADEOFF) && (allsec <LED_DOWNFADEON)){ //nappal van
if (steinhart <= (tempHeaterMin)) digitalWrite(heater, LOW);
if (steinhart >= (tempHeaterMax)) digitalWrite(heater, HIGH);}
else { if (steinhart <= (tempHeaterMinNight)) digitalWrite(heater, LOW); //éjszaka van
if (steinhart >= (tempHeaterMaxNight)) digitalWrite(heater, HIGH);}}
if (waitsteinhart > (millis())) {digitalWrite(heater, HIGH);}
if (lastheater ==1 ){(heatercntrl=1); digitalWrite (heater, LOW);}
if (lastheater ==2 ) {(heatercntrl=1); digitalWrite (heater, HIGH);}}
if (wlsv == LOW) {digitalWrite(heater, HIGH);}
heaterv=digitalRead(heater);
//ventilátor---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (waitsteinhart > (millis())){analogWrite(fan, 20);} //20-ra kell visszaírni
else {if (lastfan == 0){(fancntrl = 0);
if (average1 <= (tempFanMin)) analogWrite(fan, 20); //20-ra kell visszaírni
if((average1 >= tempFanMin) && (average1 <= tempFanMax)) {FANspeed = map(average1, tempFanMin, tempFanMax, 20, 255); analogWrite(fan, FANspeed); }
if(average1 > tempFanMax) digitalWrite (fan, HIGH);}
if (lastfan == 1){(fancntrl =1);analogWrite (fan, 0);}
if (lastfan == 2){(fancntrl =1);analogWrite (fan, 80);}
if (lastfan == 3){(fancntrl =1);analogWrite (fan, 170);}
if (lastfan == 4){(fancntrl =1);digitalWrite (fan, HIGH);}
}
if(steinhart >= tempLedHigh) if (millis() - previousMillistempz > intervaltemp) {previousMillistempz = millis(); digitalWrite(e2, HIGH);}
if((steinhart <= tempLedHigh) && (steinhart >= tempLedLow)) digitalWrite(e2, LOW);
if(steinhart <= tempLedLow) if (millis() - previousMillistempz > intervaltemp) {previousMillistempz = millis(); digitalWrite(e2, HIGH);}
//neon----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if (lastneon == 0);{ (neoncntrl=0);
if((allsec > LED_UPFADEOFF)&&(allsec <LED_DOWNFADEON)) {digitalWrite (neon, LOW);}
else {digitalWrite (neon, HIGH);}}
if (lastneon ==1) {(neoncntrl=1); digitalWrite (neon, LOW);}
if (lastneon ==2) {(neoncntrl=1); digitalWrite (neon, HIGH);}
neonv=digitalRead(neon);
//CO2------------------
if (lastco2 == 0);{(co2cntrl = 0);
if((allsec > co2on)&&(allsec <co2off)) {digitalWrite (co2, LOW);}
else {digitalWrite (co2, HIGH);}}
if (lastco2 ==1) {(co2cntrl=1); digitalWrite (co2, LOW);}
if (lastco2 ==2) {(co2cntrl=1); digitalWrite (co2, HIGH);}
co2v=digitalRead(co2);
//if (neonv != lastneonv && neonv==HIGH) {lastneonv=neonv;}
//if (neonv != lastneonv && neonv==LOW) {lastneonv=neonv; previousMillistube=millis();}
//if (neonv==LOW && (millis() - previousMillistube >= eepinterval1)){previousMillistube=millis();
// neon1oh=(neon1oh + eepintervalhour); EEPROM.updateFloat(eepneon1, neon1oh);
// neon2oh=(neon2oh + eepintervalhour); EEPROM.updateFloat(eepneon2, neon2oh);}
//if (millis() - previousMillisuptime >=eepinterval2) {uptimecount=(uptimecount+eepintervalhour); uptimecount=(uptimecount+eepintervalhour); EEPROM.updateFloat(eepuptime, uptimecount);}
//LED-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(lastled==0){(ledcntrl=0);
if(((allsec >= LED_UPFADEON) && (allsec <= LED_UPFADEMIDDLE))) {LEDv = map (allsec, LED_UPFADEON, LED_UPFADEMIDDLE, 0, 70); analogWrite(LED, LEDv);}
if(((allsec >= LED_UPFADEMIDDLE) && (allsec <= LED_UPFADEOFF))) {LEDv = map (allsec, LED_UPFADEMIDDLE, LED_UPFADEOFF, 70, 255); analogWrite(LED, LEDv);}
if((allsec >= LED_DOWNFADEON) && (allsec <= LED_DOWNFADEMIDDLE)) {LEDv = map (allsec, LED_DOWNFADEON, LED_DOWNFADEMIDDLE, 255, 70); analogWrite(LED, LEDv);}
if((allsec >= LED_DOWNFADEMIDDLE) && (allsec <= LED_DOWNFADEOFF)) {LEDv = map (allsec, LED_DOWNFADEMIDDLE, LED_DOWNFADEOFF, 70, 1); analogWrite(LED, LEDv);}
if((allsec >= LED_DOWNFADEOFF) || (allsec <= LED_UPFADEON)) {analogWrite(LED, MoonPWMValue);} //MOON
if((allsec >= LED_UPFADEOFF)&&(allsec <LED_DOWNFADEON)) {analogWrite(LED, DayLightPWMValue);}} //DAYLIGHTPLUS
if (lastled==1){(ledcntrl =1); analogWrite (LED, 0);}
if (lastled==2){(ledcntrl =1); analogWrite (LED, 80);}
if (lastled==3){(ledcntrl =1); analogWrite (LED, 210);}
if (lastled==4){(ledcntrl =1); digitalWrite (LED, HIGH);}
if((millis() - previousMillispump < pumpofftime) && (pumpofftime < millis())) {digitalWrite (pump, LOW);}
else {digitalWrite (pump, HIGH);}
if (lastplnt0 ==0) {(plnt0cntrl =0); if (allsec == plnt0time){previousMillisplnt0 = millis();}}
if (lastplnt1 ==0) {(plnt1cntrl =0); if (allsec == plnt1time){previousMillisplnt1 = millis();}}
if (lastplnt0 ==1) {plnt0cntrl =1;}
if (lastplnt0 ==2) {plnt0cntrl =1;}
if (lastplnt1 ==1) {plnt1cntrl =1;}
if (lastplnt1 ==2) {plnt1cntrl =1;}
if((millis() - previousMillisplnt0 < plnt0ontime) && (plnt0ontime < millis())) {digitalWrite (plnt0, HIGH); (delay (plnt0ontime)); digitalWrite (plnt0, LOW);}
else {digitalWrite (plnt0, LOW);}
if((millis() - previousMillisplnt1 < plnt1ontime) && (plnt1ontime < millis())) {digitalWrite (plnt1, HIGH), (delay (plnt1ontime)); digitalWrite (plnt1, LOW);}
else {digitalWrite (plnt1, LOW);}
value += encoder->getValue(); //------------------------------------------------------------------------------------------------------------------------------------------------------------
if (value != last) {last = value;
if (value==30){setupvalue = lastheater;}
if (value==31){setupvalue = lastfan;}
if (value==40){setupvalue = lastneon;}
if (value==41){setupvalue = lastled;}
if (value==50){setupvalue = lastco2;}
if (value==51){setupvalue = lastplnt0;}
if (value==52){setupvalue = lastplnt1;}}
ClickEncoder::Button b = encoder->getButton();
if (b != ClickEncoder::Open) {
#define VERBOSECASE(label) case label: Serial.println(#label); break;
switch (b) {
VERBOSECASE(ClickEncoder::Pressed);
VERBOSECASE(ClickEncoder::Released);
case ClickEncoder::Held: {(value +=100); (previousMillispump=millis());}
break;}}
if (value>22 && value<25) {value=0;}
if (value>15 && value<20) {value=0;}
if (value>31 && value<35) {value=1;}
if (value>25 && value<30) {value=1;}
if (value>41 && value<45) {value=2;}
if (value>35 && value<40) {value=2;}
if (value>52 && value<55) {value=3;}
if (value>45 && value<50) {value=3;}
if (value>61 && value<65) {value=4;}
if (value>55 && value<60) {value=4;}
if (value>65 && value<75) {value=0;}
if (value>75 && value<100) {value=100;}
if (value>=100) {value=100;}
if (value<=0) {value=0;}
if (value>=4 && value<10) {value=4;}
//LCD------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
switch(value){
case 0:
switch (b) {
case ClickEncoder::Clicked: value = (20);
break;}
lcd.home();
if( (steinhart <= tempLedLow) || (steinhart >= tempLedHigh) || (wlsv == LOW) /*|| (neon1oh > neon1ohmax) || (neon2oh > neon2ohmax)|| (filterclean > filtercleanmax) || (uptimedays > uptimedayslast)*/)
{lcd.print ("'' AQUARIUM ''");
lcd.setCursor (0,1);
lcd.print ("'' CONTROLLER ''");}
else {
lcd.print (" AQUARIUM ");
lcd.setCursor (0,1);
lcd.print (" CONTROLLER ");}
break;
/*
case 20:
lcd.home();
if (wlsv == LOW) {lcd.print ("Water Level Low!");}
else {lcd.print (" ");}
lcd.setCursor (0,1);
if(steinhart >= tempLedHigh){lcd.print ("High");}
if(steinhart <= tempLedLow){lcd.print ("Low");}
if((steinhart <= tempLedLow) || (steinhart >= tempLedHigh)) {lcd.print(" Temperature ");}
if((steinhart > tempLedLow) && (steinhart < tempLedHigh)) {lcd.print(" ");}
if((steinhart > tempLedLow) && (steinhart < tempLedHigh) && (wlsv == HIGH)) {value+=1;}
break;
case 21:
lcd.home();
if (neon1oh > neon1ohmax) {lcd.print ("1st Tube Change!");}
else {lcd.print (" ");}
lcd.setCursor (0,1);
if (neon2oh > neon2ohmax) {lcd.print ("2nd Tube Change!");}
else {lcd.print (" ");}
if((neon1oh <= neon1ohmax) && (neon2oh <= neon2ohmax)) {value+=1;}
break;
case 22:
lcd.home();
if (filterclean > filtercleanmax) {lcd.print ("Filter cleaning!");}
else {lcd.print (" ");}
lcd.setCursor (0,1);
if(uptimedays < uptimedayslast) {lcd.print ("System restart! ");}
else {lcd.print (" ");}
if((uptimehours >= uptimedayslast) && (filterclean <= filtercleanmax)) {value=0;}
break; */
case 1:
switch (b) {
case ClickEncoder::Clicked: value = (30);
break;}
lcd.home ();
lcd.print("Heater:");
if (heaterv == LOW && (heatercntrl == 0 && wlsv == HIGH)) {lcd.print("ON ");}
if (heaterv == HIGH && heatercntrl == 0 && wlsv == HIGH) {lcd.print("OFF ");}
if (heaterv == LOW && heatercntrl == 1) {lcd.print("ON' ");}
if (heaterv == HIGH && heatercntrl == 1 || wlsv == LOW) {lcd.print("OFF'");}
lcd.print (" ");
lcd.print ("Temp");
lcd.setCursor (0,1);
lcd.print("Fan:");
lcd.setCursor (4,1);
if(fancntrl == 0){ FANsz = map(FANspeed, 0, 255, 0, 99);
if((average1 >= tempFanMin) && (average1 <= tempFanMax)) {if (FANsz<10) {lcd.print("0");} lcd.print(FANsz); lcd.print("% ");}
if (average1 <= (tempFanMin)) {lcd.print("OFF ");} // "Min"
if(average1 > tempFanMax) {lcd.print ("ON ");}}
if (fancntrl == 1){lcd.print("OWR'");}
lcd.print (" ");
if (waitsteinhart > (millis())){lcd.print("--.-");}
if (waitsteinhart < (millis())){lcd.print (steinhart,1);}
lcd.print((char)223);
lcd.print ("C");
break;
case 30:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder::DoubleClicked: lastheater = setupvalue;
break;}
if (setupvalue>2){setupvalue=0;}
if (lastheater>2){lastheater=0;}
lcd.home();
lcd.print ("Heater State:");
if (heatercntrl == 0){if (heaterv == HIGH) lcd.print ("OFF");}
if (heatercntrl == 0){if (heaterv == LOW) lcd.print (" ON");}
if (heatercntrl == 1) lcd.print ("OWR");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastheater == 0 && wlsv == HIGH) {lcd.print F((" #PROG ON OFF "));}
if (setupvalue == 1 && lastheater == 0 && wlsv == HIGH) {lcd.print F((" #PROG >ON OFF "));}
if (setupvalue == 2 && lastheater == 0 && wlsv == HIGH) {lcd.print F((" #PROG ON >OFF "));}
if (setupvalue == 0 && lastheater == 1 && wlsv == HIGH) {lcd.print F((" >PROG #ON OFF "));}
if (setupvalue == 1 && lastheater == 1 && wlsv == HIGH) {lcd.print F((" PROG #ON OFF "));}
if (setupvalue == 2 && lastheater == 1 && wlsv == HIGH) {lcd.print F((" PROG #ON >OFF "));}
if (setupvalue == 0 && lastheater == 2 && wlsv == HIGH) {lcd.print F((" >PROG ON #OFF "));}
if (setupvalue == 1 && lastheater == 2 && wlsv == HIGH) {lcd.print F((" PROG >ON #OFF "));}
if (setupvalue == 2 && lastheater == 2 && wlsv == HIGH) {lcd.print F((" PROG ON #OFF "));}
if (wlsv == LOW) {lcd.print F(("Low water level!"));}
EEPROM.update(EEPheater, lastheater);
break;
case 31:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder::DoubleClicked: lastfan = setupvalue;
break;}
if (setupvalue>4){setupvalue=0;}
if (lastfan>4){lastfan=0;}
lcd.home();
lcd.print (" Fan Level: ");
if (fancntrl == 0 && (average1 <= (tempFanMin))) {lcd.print ("OFF ");} //"Min "
if (fancntrl == 0 && (average1 > (tempFanMin) && (average1 < (tempFanMax)))) {if (FANsz<10) {lcd.print("0");} FANsz == lcd.print (FANsz); lcd.print ("% ");}
if (fancntrl == 0 && (average1 >= (tempFanMin))) {lcd.print ("ON ");}
if (fancntrl == 1) lcd.print ("OWR ");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastfan == 0) {lcd.print F((" #P 0 1 2 3 "));}
if (setupvalue == 1 && lastfan == 0) {lcd.print F((" #P >0 1 2 3 "));}
if (setupvalue == 2 && lastfan == 0) {lcd.print F((" #P 0 >1 2 3 "));}
if (setupvalue == 3 && lastfan == 0) {lcd.print F((" #P 0 1 >2 3 "));}
if (setupvalue == 4 && lastfan == 0) {lcd.print F((" #P 0 1 2 >3 "));}
if (setupvalue == 0 && lastfan == 1) {lcd.print F((" >P #0 1 2 3 "));}
if (setupvalue == 1 && lastfan == 1) {lcd.print F((" P #0 1 2 3 "));}
if (setupvalue == 2 && lastfan == 1) {lcd.print F((" P #0 >1 2 3 "));}
if (setupvalue == 3 && lastfan == 1) {lcd.print F((" P #0 1 >2 3 "));}
if (setupvalue == 4 && lastfan == 1) {lcd.print F((" P #0 1 2 >3 "));}
if (setupvalue == 0 && lastfan == 2) {lcd.print F((" >P 0 #1 2 3 "));}
if (setupvalue == 1 && lastfan == 2) {lcd.print F((" P >0 #1 2 3 "));}
if (setupvalue == 2 && lastfan == 2) {lcd.print F((" P 0 #1 2 3 "));}
if (setupvalue == 3 && lastfan == 2) {lcd.print F((" P 0 #1 >2 3 "));}
if (setupvalue == 4 && lastfan == 2) {lcd.print F((" P 0 #1 2 >3 "));}
if (setupvalue == 0 && lastfan == 3) {lcd.print F((" >P 0 1 #2 3 "));}
if (setupvalue == 1 && lastfan == 3) {lcd.print F((" P >0 1 #2 3 "));}
if (setupvalue == 2 && lastfan == 3) {lcd.print F((" P 0 >1 #2 3 "));}
if (setupvalue == 3 && lastfan == 3) {lcd.print F((" P 0 1 #2 3 "));}
if (setupvalue == 4 && lastfan == 3) {lcd.print F((" P 0 1 #2 >3 "));}
if (setupvalue == 0 && lastfan == 4) {lcd.print F((" >P 0 1 2 #3 "));}
if (setupvalue == 1 && lastfan == 4) {lcd.print F((" P >0 1 2 #3 "));}
if (setupvalue == 2 && lastfan == 4) {lcd.print F((" P 0 >1 2 #3 "));}
if (setupvalue == 3 && lastfan == 4) {lcd.print F((" P 0 1 >2 #3 "));}
if (setupvalue == 4 && lastfan == 4) {lcd.print F((" P 0 1 2 #3 "));}
EEPROM.update(EEPfan, lastfan);
break;
case 2:
switch (b) {
case ClickEncoder::Clicked: value = (40);
break;}
lcd.home();
lcd.print("Neon:");
if (neoncntrl == 0){
if (neonv==LOW)
{
lcd.print("ON ");}
else {lcd.print ("OFF ");}}
if (neoncntrl == 1 && lastneon == 1) {lcd.print("ON' ");}
if (neoncntrl == 1 && lastneon == 2) {lcd.print("OFF' ");}
if (t.hour<10)
{
lcd.print("0");
}
lcd.print(t.hour, DEC);
lcd.print(":");
if (t. min<10)
{
lcd.print("0");
}
lcd.print(t.min, DEC);
lcd.setCursor (0,1);
lcd.print("LED:");
if (ledcntrl==0){
leddisp = map(LEDv, 0, 255, 0, 99);
if((allsec >= LED_UPFADEON) && (allsec <= LED_UPFADEOFF)) {if (leddisp<10){lcd.print("0");} lcd.print(leddisp); lcd.print("% ");}
if((allsec >= LED_DOWNFADEON) && (allsec <= LED_DOWNFADEOFF)) {if (leddisp<10){lcd.print("0");} lcd.print(leddisp); lcd.print("% ");}
if((allsec >= LED_DOWNFADEOFF) || (allsec <= LED_UPFADEON)) {lcd.print ("Moon");}
if((allsec > LED_UPFADEOFF)&&(allsec <LED_DOWNFADEON)) {lcd.print ("DayL");}}
else lcd.print("OWR'");
lcd.print(" ");
byte realmonth;
realmonth=(t.mon);
if (realmonth==1) {lcd.print("Jan");}
if (realmonth==2) {lcd.print("Feb");}
if (realmonth==3) {lcd.print("Mar");}
if (realmonth==4) {lcd.print("Apr");}
if (realmonth==5) {lcd.print("May");}
if (realmonth==6) {lcd.print("Jun");}
if (realmonth==7) {lcd.print("Jul");}
if (realmonth==8) {lcd.print("Aug");}
if (realmonth==9) {lcd.print("Sep");}
if (realmonth==10) {lcd.print("Oct");}
if (realmonth==11) {lcd.print("Nov");}
if (realmonth==12) {lcd.print("Dec");}
lcd.print("/");
if (t.date <10)
{
lcd.print("0");}
lcd.print(t.date, DEC);
break;
/*
case 40:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder:oubleClicked: lastneon = setupvalue;
break;}
if (setupvalue>2){setupvalue=0;}
if (lastneon>2){lastneon=0;}
lcd.home();
lcd.print ("Neon State: ");
if (neoncntrl == 0){if (neonv == HIGH) lcd.print ("OFF ");}
if (neoncntrl == 0){if (neonv == LOW) lcd.print (" ON ");}
if (neoncntrl == 1) lcd.print ("OWR ");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastneon == 0) {lcd.print F((" #PROG ON OFF "));}
if (setupvalue == 1 && lastneon == 0) {lcd.print F((" #PROG >ON OFF "));}
if (setupvalue == 2 && lastneon == 0) {lcd.print F((" #PROG ON >OFF "));}
if (setupvalue == 0 && lastneon == 1) {lcd.print F((" >PROG #ON OFF "));}
if (setupvalue == 1 && lastneon == 1) {lcd.print F((" PROG #ON OFF "));}
if (setupvalue == 2 && lastneon == 1) {lcd.print F((" PROG #ON >OFF "));}
if (setupvalue == 0 && lastneon == 2) {lcd.print F((" >PROG ON #OFF "));}
if (setupvalue == 1 && lastneon == 2) {lcd.print F((" PROG >ON #OFF "));}
if (setupvalue == 2 && lastneon == 2) {lcd.print F((" PROG ON #OFF "));}
EEPROM.update(EEPneon, lastneon);
break;
case 41:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder:oubleClicked: lastled = setupvalue;
break;}
if (setupvalue>4){setupvalue=0;}
if (lastled>4){lastled=0;}
lcd.home();
lcd.print ("LED Level: ");
if (ledcntrl == 0) {lcd.print ("PROG ");}
if (ledcntrl == 1) lcd.print ("OWR ");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastled == 0) {lcd.print F((" #P 0 1 2 3 "));}
if (setupvalue == 1 && lastled == 0) {lcd.print F((" #P >0 1 2 3 "));}
if (setupvalue == 2 && lastled == 0) {lcd.print F((" #P 0 >1 2 3 "));}
if (setupvalue == 3 && lastled == 0) {lcd.print F((" #P 0 1 >2 3 "));}
if (setupvalue == 4 && lastled == 0) {lcd.print F((" #P 0 1 2 >3 "));}
if (setupvalue == 0 && lastled == 1) {lcd.print F((" >P #0 1 2 3 "));}
if (setupvalue == 1 && lastled == 1) {lcd.print F((" P #0 1 2 3 "));}
if (setupvalue == 2 && lastled == 1) {lcd.print F((" P #0 >1 2 3 "));}
if (setupvalue == 3 && lastled == 1) {lcd.print F((" P #0 1 >2 3 "));}
if (setupvalue == 4 && lastled == 1) {lcd.print F((" P #0 1 2 >3 "));}
if (setupvalue == 0 && lastled == 2) {lcd.print F((" >P 0 #1 2 3 "));}
if (setupvalue == 1 && lastled == 2) {lcd.print F((" P >0 #1 2 3 "));}
if (setupvalue == 2 && lastled == 2) {lcd.print F((" P 0 #1 2 3 "));}
if (setupvalue == 3 && lastled == 2) {lcd.print F((" P 0 #1 >2 3 "));}
if (setupvalue == 4 && lastled == 2) {lcd.print F((" P 0 #1 2 >3 "));}
if (setupvalue == 0 && lastled == 3) {lcd.print F((" >P 0 1 #2 3 "));}
if (setupvalue == 1 && lastled == 3) {lcd.print F((" P >0 1 #2 3 "));}
if (setupvalue == 2 && lastled == 3) {lcd.print F((" P 0 >1 #2 3 "));}
if (setupvalue == 3 && lastled == 3) {lcd.print F((" P 0 1 #2 3 "));}
if (setupvalue == 4 && lastled == 3) {lcd.print F((" P 0 1 #2 >3 "));}
if (setupvalue == 0 && lastled == 4) {lcd.print F((" >P 0 1 2 #3 "));}
if (setupvalue == 1 && lastled == 4) {lcd.print F((" P >0 1 2 #3 "));}
if (setupvalue == 2 && lastled == 4) {lcd.print F((" P 0 >1 2 #3 "));}
if (setupvalue == 3 && lastled == 4) {lcd.print F((" P 0 1 >2 #3 "));}
if (setupvalue == 4 && lastled == 4) {lcd.print F((" P 0 1 2 #3 "));}
EEPROM.update(EEPled, lastled);
break; */
case 3:
switch (b) {
case ClickEncoder::Clicked: value = (50);
break;}
lcd.home();
lcd.print ("CO");
lcd.write(byte(0));
lcd.print (" Solenoid:");
if (co2cntrl == 0){if (co2v == HIGH) lcd.print ("OFF");}
if (co2cntrl == 0){if (co2v == LOW) lcd.print (" ON");}
if (co2cntrl == 1) lcd.print ("OWR");
lcd.setCursor (0,1);
if (plnt0cntrl==1) {lcd.print ("'");} else {lcd.print(" ");}
lcd.print ("Misc. Options ");
if (plnt1cntrl==1) {lcd.print ("'");} else {lcd.print(" ");}
break;
case 50:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder::DoubleClicked: lastco2 = setupvalue;
break;}
if (setupvalue>2){setupvalue=0;}
if (lastco2>2){lastco2=0;}
lcd.home();
lcd.print ("CO");
lcd.write(byte(0));
lcd.print (" Solenoid:");
if (co2cntrl == 0){if (co2v == HIGH) lcd.print ("OFF");}
if (co2cntrl == 0){if (co2v == LOW) lcd.print (" ON");}
if (co2cntrl == 1) lcd.print ("OWR");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastco2 == 0) {lcd.print F((" #PROG ON OFF ")); (co2cntrl =0);}
if (setupvalue == 1 && lastco2 == 0) {lcd.print F((" #PROG >ON OFF ")); (co2cntrl =0);}
if (setupvalue == 2 && lastco2 == 0) {lcd.print F((" #PROG ON >OFF ")); (co2cntrl =0);}
if (setupvalue == 0 && lastco2 == 1) {lcd.print F((" >PROG #ON OFF ")); (co2cntrl =1);}
if (setupvalue == 1 && lastco2 == 1) {lcd.print F((" PROG #ON OFF ")); (co2cntrl =1);}
if (setupvalue == 2 && lastco2 == 1) {lcd.print F((" PROG #ON >OFF ")); (co2cntrl =1);}
if (setupvalue == 0 && lastco2 == 2) {lcd.print F((" >PROG ON #OFF ")); (co2cntrl =1);}
if (setupvalue == 1 && lastco2 == 2) {lcd.print F((" PROG >ON #OFF ")); (co2cntrl =1);}
if (setupvalue == 2 && lastco2 == 2) {lcd.print F((" PROG ON #OFF ")); (co2cntrl =1);}
EEPROM.update(EEPco2, lastco2);
break;
/*
case 51:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder:oubleClicked: lastplnt0 = setupvalue;
break;}
if (setupvalue>2){setupvalue=0;}
if (lastplnt0>2){lastplnt0=0;}
lcd.home();
lcd.print (" TF Macro: ");
if (plnt0cntrl == 0){if (plnt0v == LOW) lcd.print ("OFF ");}
if (plnt0cntrl == 0){if (plnt0v == HIGH) lcd.print ("ON ");}
if (plnt0cntrl == 1) lcd.print ("OWR ");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastplnt0 == 0) {lcd.print F((" #PROG 1x OFF "));}
if (setupvalue == 1 && lastplnt0 == 0) {lcd.print F((" #PROG >1x OFF "));}
if (setupvalue == 2 && lastplnt0 == 0) {lcd.print F((" #PROG 1x >OFF "));}
if (setupvalue == 1 && lastplnt0 == 1) {lcd.print F((" PROG #1x OFF ")); previousMillisplnt0 = millis(); setupvalue=0; lastplnt0 =0;}
if (setupvalue == 0 && lastplnt0 == 2) {lcd.print F((" >PROG 1x #OFF "));}
if (setupvalue == 1 && lastplnt0 == 2) {lcd.print F((" PROG >1x #OFF "));}
if (setupvalue == 2 && lastplnt0 == 2) {lcd.print F((" PROG 1x #OFF "));}
EEPROM.update(EEPplnt0, lastplnt0);
break;
case 52:
switch (b) {
case ClickEncoder::Clicked: setupvalue = (setupvalue+1);
break;
case ClickEncoder:oubleClicked: lastplnt1 = setupvalue;
break;}
if (setupvalue>2){setupvalue=0;}
if (lastplnt1>2){lastplnt1=0;}
lcd.home();
lcd.print (" EasyCarbo: ");
if (plnt1cntrl == 0){if (plnt1v == LOW) lcd.print ("OFF ");}
if (plnt1cntrl == 0){if (plnt1v == HIGH) lcd.print ("ON ");}
if (plnt1cntrl == 1) lcd.print ("OWR ");
lcd.setCursor (0,1);
if (setupvalue == 0 && lastplnt1 == 0) {lcd.print F((" #PROG 1x OFF "));}
if (setupvalue == 1 && lastplnt1 == 0) {lcd.print F((" #PROG >1x OFF "));}
if (setupvalue == 2 && lastplnt1 == 0) {lcd.print F((" #PROG 1x >OFF "));}
if (setupvalue == 1 && lastplnt1 == 1) {lcd.print F((" PROG #1x OFF ")); previousMillisplnt1 = millis(); setupvalue=0; lastplnt1 =0;}
if (setupvalue == 0 && lastplnt1 == 2) {lcd.print F((" >PROG 1x #OFF "));}
if (setupvalue == 1 && lastplnt1 == 2) {lcd.print F((" PROG >1x #OFF "));}
if (setupvalue == 2 && lastplnt1 == 2) {lcd.print F((" PROG 1x #OFF "));}
EEPROM.update(EEPplnt1, lastplnt1);
break; */
case 4:
switch (b) {
case ClickEncoder::Clicked: value = (60);
break;
case ClickEncoder::DoubleClicked: value = (70);
break;}
lcd.home();
lcd.print (" Informations ");
lcd.setCursor(0,1);
lcd.print (" ");
break;
/*
case 60:
lcd.home();
lcd.print(" System Uptime: ");
lcd.setCursor(0,1);
if (uptimedays<10) {lcd.print("0");}
lcd.print(uptimedays);
lcd.print("days, ");
if (uptimehours<10) {lcd.print("0");}
lcd.print(uptimehours);
lcd.print(":");
if (uptimemins<10) {lcd.print("0");}
lcd.print(uptimemins);
lcd.print(":");
if (uptimesecs<10) {lcd.print("0");}
lcd.print(uptimesecs);
break;
case 61:
lcd.home();
lcd.print(" Free Memory: ");
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(freeMemory());
lcd.print("kB ");
break; */
case 70:
/* Wire.endTransmission();
Wire.begin();
delay(50);
rtc.begin();
delay(500);
lcd.begin (16,2);
lcd.createChar(0, small2);
lcd.setBacklightPin(3,POSITIVE);
lcd.setBacklight(HIGH);
delay(100); */
break;
/* case 3:
lcd.home();
lcd.print (F(" Osram 6500K "));
lcd.setCursor (0,1);
lcd.print (F("Op.hrs:"));
if (neon1oh<10) {lcd.print(" ");}
if ((neon1oh<100) && (neon1oh>9)) {lcd.print(" ");}
if ((neon1oh<1000) && (neon1oh>99)) {lcd.print(" ");}
if ((neon1oh<10000) && (neon1oh>999)) {lcd.print(" ");}
if ((neon1oh<100000) && (neon1oh>9999)) {lcd.print(" ");}
if ((neon1oh<1000000) && (neon1oh>99999)) {lcd.print(" ");}
lcd.print(neon1oh,1);
lcd.print("h");
break;
case 4:
lcd.home();
lcd.print (" Grolux 3000K ");
lcd.setCursor (0,1);
lcd.print (F("Op.hrs:"));
neon2oh=EEPROM.readFloat(eepneon2);
if (neon2oh<10) {lcd.print(" ");}
if ((neon2oh<100) && (neon2oh>9)) {lcd.print(" ");}
if ((neon2oh<1000) && (neon2oh>99)) {lcd.print(" ");}
if ((neon2oh<10000) && (neon2oh>999)) {lcd.print(" ");}
if ((neon2oh<100000) && (neon2oh>9999)) {lcd.print(" ");}
if ((neon2oh<1000000) && (neon2oh>99999)) {lcd.print(" ");}
lcd.print(neon2oh,1);
lcd.print("h");
break; */
case 100:
lcd.home ();
lcd.print(" Pump OFF ");
lcd.setCursor(0,1);
lcd. print (" ");
lcd. print (offpump);
lcd. print (" minutes ");
feedcount=1; displayowr=0;
if((millis() - previousMillispump) >= intervalpump) {(value=0);}
break;
}
if ((millis() - previousMilliswifi2 >= intervalwifi2)) { previousMilliswifi2 =millis();
cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += IP;
cmd += "\",80";
delay(5000);
Serial.println("ERROR while SENDING");}
cmd = GET + "&field1=" + steinhart + "\r\n";
esp8266Module.
print("AT+CIPSEND=");
esp8266Module.
println(cmd.
length());
delay(15000);
Serial.println("Data sent");}
else
{esp8266Module.
println("AT+CIPCLOSE"); Serial.
println("Connection closed");
}
}
/*Serial.print (F("Water level: "));
if (wlsv==LOW) Serial.println(F("LOW"));
if (wlsv==HIGH)Serial.println(F("NORMAL"));
Serial.print(F("Temperature "));
Serial.print(steinhart);
Serial.println(F(" *C"));
Serial.println(average1);
Serial.print(F("HEATER: "));
if(heaterv==HIGH) {Serial.println(F("OFF"));}
if(heaterv==LOW) {Serial.println(F("ON"));}
Serial.print(F("FAN: "));
if(fan==LOW) {Serial.println(F("OFF"));}
else {Serial.println(F("ON"));}
Serial.print(F("PUMP: "));
if(pumpv==HIGH) {Serial.println(F("ON"));}
if(pumpv==LOW) {Serial.println(F("OFF"));}
Serial.print(t.date, DEC);
Serial.print("/");
Serial.print(rtc.getMonthStr());
Serial.print("/");
Serial.print(t.year, DEC);
Serial.print(" - ");
Serial.print(t.hour, DEC);
Serial.print(":");
Serial.print(t.min, DEC);
Serial.print(":");
Serial.println(t.sec, DEC);
Serial.print (F("Allsec: "));
Serial.println(allsec);
Serial.println(neon1oh);
Serial.println(neon2oh);
Serial.println(value);
Serial.print(F("NEON: "));
if(neonv==HIGH) {Serial.println(F("OFF"));}
if(neonv==LOW) {Serial.println(F("ON"));}
Serial.print(F("LED: "));
if(LED==MoonPWMValue) {Serial.println(F("MOON"));}
if(LED==DayLightPWMValue) {Serial.println(F("DAYLIGHT"));}
if((LED != MoonPWMValue) || (LED != DayLightPWMValue)) {Serial.println(F("FADE"));}
Serial.println(previousMillispump);
Serial.println(lastwls); */
}