Multi Channel water level sensor

Expansion modules and attachments
Post Reply
Drew471
Posts: 21
Joined: Sun Oct 06, 2013 5:54 pm

Multi Channel water level sensor

Post by Drew471 »

I am trying to use channel one on the multilevel water sensor for my auto top off.

The problem is using the Wizard it defaults to channel 0, how do I change this to go to channel one? go inside the library?

Thanks!
Drew
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Multi Channel water level sensor

Post by rimai »

The libraries only support the single channel at the moment.
I created a bug report to add support to the new channels.
https://github.com/reefangel/Libraries/issues/138
Roberto.
Drew471
Posts: 21
Joined: Sun Oct 06, 2013 5:54 pm

Re: Multi Channel water level sensor

Post by Drew471 »

So if I wanted to program it without the wizard how would I program that to turn a port on or off based about the level of the water of sensor 1(on at X% off at Y%).


Thanks!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Multi Channel water level sensor

Post by rimai »

Try this:

Code: Select all

if (ReefAngel.WaterLevel.GetLevel(1)<=20) ReefAngel.Relay.On(Port1);
if (ReefAngel.WaterLevel.GetLevel(1)>=30) ReefAngel.Relay.Off(Port1);
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Multi Channel water level sensor

Post by Sacohen »

Gotta remember this for when I get my multi level unit in about a month.
Drew471
Posts: 21
Joined: Sun Oct 06, 2013 5:54 pm

Re: Multi Channel water level sensor

Post by Drew471 »

Okay so what if I wanted a time out on that? Also can I do conditional such as If Sensor 1 is above X AND Sensor 2 is above Y then turn the pump on?

I am planning on having one in my water top off tank so I would like it to text/email me when below X and then Text/email me AND not allow the port to turn on when below Y%.

Does that make sense? Thanks! I am still learning how this programming thing works

Also I am planning on
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Multi Channel water level sensor

Post by rimai »

The timeout is not implemented yet.
It is in the list of issues: https://github.com/reefangel/Libraries/issues/138
For and comparisons you can use this:

Code: Select all

if (ReefAngel.WaterLevel.GetLevel(1)>=20 && ReefAngel.WaterLevel.GetLevel(2)>=30)
 ReefAngel.Relay.On(Port1);
else
 ReefAngel.Relay.Off(Port1);
According to this code, there pump would not turn on if 1 is below 20 or 2 is below 30.
Both the conditions need to be true in order for the pump to turn on.
That's what the && sign is for. It reads AND.
Here is some more info:
http://arduino.cc/en/Reference/Boolean
Roberto.
Post Reply