Page 1 of 1

Newbie question - Doser Code

Posted: Sun Nov 16, 2014 6:09 pm
by rrodriguess
Hi there

I would like to start the pump the second I hit the WATERCHANGE_MODE menu for 10 seconds.. so i thought something like that:

if(ReefAngel.DisplayedMenu==WATERCHANGE_MODE) ReefAngel.DosingPump(Port8,1, hour(), minute(), 10);


I also tryed:

byte h = hour();
byte m = minute();
if(ReefAngel.DisplayedMenu==WATERCHANGE_MODE) ReefAngel.DosingPump(Port8,1, h, m, 10);

I am getting no error compiling... but it is not working as expect.

Can someone help me out?

Best regards
Rafa

Re: Newbie question - Doser Code

Posted: Sun Nov 16, 2014 9:24 pm
by lnevo
That won't work right for sure. Try this:

Code: Select all

static unsigned long wcDosingTimer;
if (ReefAngel.DisplayedMenu!=WATERCHANGE_MODE) wcDosingTimer=now()+10; // Set time for 10 seconds from now
if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE && now()<wcDosingTimer) { // Start comparing now to timer and dose accordingly
  ReefAngel.Relay.On(Port8); 
} else {
  ReefAngel.Relay.Off(Port8);
} 

Re: Newbie question - Doser Code

Posted: Mon Nov 17, 2014 2:43 am
by rrodriguess
Tks Inevo!!