hello all
I would like to do a water change on my aquarium system on Sundays at noon.
This event would have to turn off 3 pumps and allow time for the display tanks to drain down into my sump/filtration tank after pumps are off.
this part can be accomplished by using a timer or with input from float switches or ultrasonic sensors i have in place
Once the system has finished draining start a pump to drain out water to the house sewage system until a float switch is activated,at which point turning off the drain pump and turning on the refill pump.
When the water is back to the needed level
IE the level the water is at when the display pumps are turned off and the water drains from them to the sump tank
at which point turn off the refill pump and turn the display pumps back on.
I have found this code
unsigned long currentMillis;
unsigned long previousMillis;
unsigned long elapsedTime;
unsigned long duration = 3600000UL; // one hour
relayControl = 2;
void setup(){
// whatever
pinMode (relayControl, OUTPUT);
digitalWrite (relayControl, LOW); // assume a HIGH will drive NPN base to pull relay coil low
previousMillis = millis();
}
void loop(){
currentTime = millis(); // capture current "time"
elapsedTime = currentTime - previousTime; // how much has gone by?
if (elapsedTime >=duration){ // if more than 1 hour
previousTime = previousTime + duration; // set up for next hour
hourCount = hourCount +1; // increment hour count
if (hourCount == 120){ // days = hours 0-23, 24-47, 48-71, 72-95, 96-119
hourCount = 0; // reset after 5 days
}
if ( (hourCount >=0) & (hourCount <3) ){ // turn on relay for hours 0,1,2
digitalWrite(relayControl, HIGH);
}
else {
digitalWrite (relayControl, LOW);
}
} // end time interval check
} // end loop
which i think is what i need to use to accomplish this but do not understand how to make it work were the event will happen on a Sunday at noon
if someone could explain how to do that or suggest a more appropriate way of doing this i would be extremely thankful
James