Page 1 of 1

Buzzer interval when waterlevel is low

Posted: Sun Sep 20, 2015 5:46 pm
by lmolenmaker
Hi guys,

I would like some help from you.

I have my water-level sensor in my freshwater reservoir.

I would like to have my buzzer (connected to actinic channel) activated when the level reaches 20%. It needs to be an interval, not continuous, lets say every minute for 1 second at 100% loudness.

It also needs to switch off my fresh water pump (relay 3).

Can somebody please provide me with a piece code.

That would be much appreciated.

Thanks in advance.

Leslie

Re: Buzzer interval when waterlevel is low

Posted: Mon Sep 21, 2015 10:58 pm
by rimai
Is it less or more than 20%?
What function are you using right now for port 3?

Re: Buzzer interval when waterlevel is low

Posted: Tue Sep 22, 2015 6:23 am
by lnevo
Its in ATO reservoir so I would assume alert if less than 20%

Re: Buzzer interval when waterlevel is low

Posted: Wed Sep 23, 2015 9:49 pm
by lmolenmaker
Sorry, for replying so late and for not being clear.

I meant less than 20% and the power of my freshwater pump is connected to port 3.

My freshwater pump switches on when the float switch is activated in my sump. This float switch is a stand alone and not connected to the ReefAngel.

So basically it needs to switch Port 3 off when the level is lower than 20% in the fresh water reservoir and let a buzzer go with an interval. A continuous buzz will drive me and the rest of the family crazy.

Thanks for your help guys

Leslie

Re: Buzzer interval when waterlevel is low

Posted: Sat Sep 26, 2015 4:25 pm
by lmolenmaker
Anybody?

Re: Buzzer interval when waterlevel is low

Posted: Sun Sep 27, 2015 7:13 am
by lnevo
This should do it:

Code: Select all

if (ReefAngel.WaterLevel.GetLevel() < 20) {
  ReefAngel.Relay.Off(Port3);
  ReefAngel.PWM.SetActinic( (now()%60<1)*100 ); // Set 100 to the volume % you want. 
}

Re: Buzzer interval when waterlevel is low

Posted: Thu Oct 01, 2015 4:06 pm
by lmolenmaker
Thank you Lee.

What does the %60<1 stand for?

Leslie

Re: Buzzer interval when waterlevel is low

Posted: Thu Oct 01, 2015 6:14 pm
by rimai
% is a mathematical formula of modulo.
https://en.wikipedia.org/wiki/Modulo_operation
Basically it means one second out of every 60