Float switch as a fail safe for the waterlevel expansion

Do you have a question on how to do something.
Ask in here.
Post Reply
lmolenmaker
Posts: 59
Joined: Tue Nov 12, 2013 5:58 am

Float switch as a fail safe for the waterlevel expansion

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

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

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

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

Post by lnevo »

Make sure the float switch check comes after anything that would turn it on.
lmolenmaker
Posts: 59
Joined: Tue Nov 12, 2013 5:58 am

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

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

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

Post by lnevo »

Sorry forgot the () after IsActive
lmolenmaker
Posts: 59
Joined: Tue Nov 12, 2013 5:58 am

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

Post by lmolenmaker »

Thank you Lee,

So the only difference is the exclamation mark in front of ReefAngel to do the reverse thing?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

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

Post by lnevo »

Yeah that means if we're not active. You may have to remove that if the behavior isnt what you'd expect
Post Reply