Page 1 of 1

Float switch as a fail safe for the waterlevel expansion

Posted: Mon Mar 02, 2015 11:00 pm
by lmolenmaker
Hi guys, I have the following code for my waterlevel expansion:

// If waterlevel is below 94%, Freshwater ATO on until 99% or greater

if (ReefAngel.WaterLevel.GetLevel()<=94) ReefAngel.Relay.On(Port5);
if (ReefAngel.WaterLevel.GetLevel()>=99) ReefAngel.Relay.Off(Port5);


Now, I noticed that sometimes the reading is lower than it supposed to be (leak somewhere).

I would use my float switch (high ato ) as a failsafe, however I would like to keep the wires on the top (out of the water).

Is there a line of code that when the high auto is deactivated (float touching the wire end) as a result of Freshwater pump kept running, port 5 will be switched off. And where do I put the code? Before or after the code, mentioned above? I don't want it to be in conflict with the above code.

Hope you guys can help me out.

Leslie

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Tue Mar 03, 2015 5:59 am
by lnevo
if (!ReefAngel.HighATO.IsActive) ReefAngel.Relay.Off(Port5);

I would also consider replacing the code you have with the WaterLevelATO function. This will give you the benefit of a timeout as well.

ReefAngel.WaterLevelATO(Port5,30,94,99);

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Tue Mar 03, 2015 5:59 am
by lnevo
Make sure the float switch check comes after anything that would turn it on.

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Tue Mar 03, 2015 2:18 pm
by lmolenmaker
Thank you Lee.

When I put the code at the end, I get the following error:

sketch_Jan15_2015_A.cpp: In function 'void loop()':
sketch_Jan15_2015_A:234: error: could not convert 'ReefAngel.ReefAngelClass::HighATO.RA_ATOHighClass::IsActive' to 'bool'
sketch_Jan15_2015_A:234: error: in argument to unary !


Any suggestions?

Thanks in advance.

Leslie

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Wed Mar 04, 2015 5:10 am
by lnevo
Sorry forgot the () after IsActive

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Wed Mar 04, 2015 5:31 am
by lmolenmaker
Thank you Lee,

So the only difference is the exclamation mark in front of ReefAngel to do the reverse thing?

Re: Float switch as a fail safe for the waterlevel expansion

Posted: Wed Mar 04, 2015 9:17 am
by lnevo
Yeah that means if we're not active. You may have to remove that if the behavior isnt what you'd expect