Multiple on/off times
Re: Multiple on/off times
Awesome. Post up your full code now. Lets see what you ended up with.
Re: Multiple on/off times
This is the code that wound up working.
Code: Select all
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// Place global variable code above here
Code: Select all
void loop()
{
ReefAngel.StandardLights( Port1,12,0,22,0 );
ReefAngel.StandardLights( Port2,13,0,21,0 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
ReefAngel.StandardLights( Port7,13,0,21,0 );
ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
ReefAngel.WaterLevelATO(Port6,720,29,31); // Enable ATO the ATO
if (ReefAngel.Relay.Status(Port5)) // Check to see if port 5 is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.WaterLevelATO(Port6,720,0,1);
}
ReefAngel.PWM.SetActinic(MyCustomWave(50));
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
Re: Multiple on/off times
See, I told you we'd get it!
--Colin
--Colin
Re: Multiple on/off times
I knew we would get it, but I didn't want to take any more of your and Lee's time.
Glad we wrapped it up this quick.
Glad we wrapped it up this quick.
Re: Multiple on/off times
Can you set at partial # in the water level sensor.
like 29.5% or does it need to be full #'s?
If so would it be 295 or 29.5?
like 29.5% or does it need to be full #'s?
If so would it be 295 or 29.5?
Re: Multiple on/off times
Nope. Has to be a whole number. They're defined as byte type.Sacohen wrote:Can you set at partial # in the water level sensor.
like 29.5% or does it need to be full #'s?
If so would it be 295 or 29.5?
--Colin
Re: Multiple on/off times
Im still waiting to hear what happened with the priest and rabbi..
Re: Multiple on/off times
A rabbi, a priest, and a Lutheran minister walk into a bar. The bartender looks up and says, "Is this some kind of joke?"
or
the Priest asks the Rabbi "Have you ever tried a bacon sandwich or even fancied one? The Rabbi answers "Well i have speculated about it but my faith forbids me from trying, but father, have you ever fancied a nice night of sex with a good woman, i mean a really good woman?" The Priest thinks hard and answers " Well Rabbi, i have sometimes wondered but my vow of celibacy prevents it from ever occurring" The Rabbi answers "Sure as hell beats a bacon sandwich, don't it?"
or
the Priest asks the Rabbi "Have you ever tried a bacon sandwich or even fancied one? The Rabbi answers "Well i have speculated about it but my faith forbids me from trying, but father, have you ever fancied a nice night of sex with a good woman, i mean a really good woman?" The Priest thinks hard and answers " Well Rabbi, i have sometimes wondered but my vow of celibacy prevents it from ever occurring" The Rabbi answers "Sure as hell beats a bacon sandwich, don't it?"
Re: Multiple on/off times
Lee;
I've forgot how my code for the denitrification chamber is set up.
I want to change the amount of time that the pump is on from 20 min to 10 min.
This is the original code...
Do I change it at the DeNit_Doser Runtime or in this line...
To this....
I've forgot how my code for the denitrification chamber is set up.
I want to change the amount of time that the pump is on from 20 min to 10 min.
This is the original code...
Code: Select all
// DeNitrate Routine
int DeNit_Offset=3600;
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=1200;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;
// Pump comes on first
ReefAngel.Relay.Set(DeNit_Pump,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
Code: Select all
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
Code: Select all
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<600); // Runs for 600s every 21600 seconds with 1200s offset
Re: Multiple on/off times
First off why don't we confirm that we're talking about the carbon source dosing pump and not the chamber fill/flush pump. Is yours like DrThompson? Are you dosing methanol?
Finally I believe you got it perfect it. What you should do now is change it ALSO in the Denit_Doser_Runtime and then at some point replace the numbers defined with the variable names so next time or for someone else who comes along you/them just need to change the variables.
Finally I believe you got it perfect it. What you should do now is change it ALSO in the Denit_Doser_Runtime and then at some point replace the numbers defined with the variable names so next time or for someone else who comes along you/them just need to change the variables.
Re: Multiple on/off times
I'm talking about changing the time on the dosing pump.
Yes it is like DrThompsons. I have an actual denitrification chamber and pump from NatuReef and am switching from the Nitragone that they sell to a 50% Methanol/RODI mix, like he runs.
So it would be like this...
Yes it is like DrThompsons. I have an actual denitrification chamber and pump from NatuReef and am switching from the Nitragone that they sell to a 50% Methanol/RODI mix, like he runs.
So it would be like this...
Code: Select all
// DeNitrate Routine
int DeNit_Offset=3600;
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=600;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;
// Pump comes on first
ReefAngel.Relay.Set(DeNit_Pump,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-3600)-1200)%21600<600); // Runs for 600s every 21600 seconds with 1200s offset
Re: Multiple on/off times
Yes, but let's use this finally...
And replace the DeNit_ATO_Offtime wherever you have that as well so you can just use the variables moving forward. You'll be less confused and you'll see what each number means.
Code: Select all
// DeNitrate Routine
int DeNit_Offset=3600;
int DeNit_Repeat=21600;
int DeNit_Doser_Offset=1200;
int DeNit_Doser_Runtime=600;
int DeNit_Pump_Runtime=1200;
int DeNit_ATO_Offtime=1500;
// Pump comes on first
ReefAngel.Relay.Set(DeNit_Pump,(now()-DeNit_Offset)%DeNit_Repeat<DeNit_Pump_Runtime); // Runs denitrator pump
// Doser comes on second
ReefAngel.Relay.Set(DeNit_Doser,((now()-DeNit_Offset)-DeNit_Doser_Offset)%DeNit_Repeat<DeNit_Doser_Runtime); // Runs denitrator doser