Newbie question - Doser Code

Do you have a question on how to do something.
Ask in here.
Post Reply
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Newbie question - Doser Code

Post 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
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Newbie question - Doser Code

Post 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);
} 
rrodriguess
Posts: 133
Joined: Sun Mar 09, 2014 11:01 am
Location: Santos - Brazil

Re: Newbie question - Doser Code

Post by rrodriguess »

Tks Inevo!!
Image
Post Reply