Page 1 of 1

Link status of two different ports

Posted: Tue Dec 24, 2013 6:22 pm
by aranax
Hey guys,
How can I check the status of a port and then change the status of another port depending on it?

Example:
Check Port 8 (to see if its ON or OFF)
if OFF turn off Port 7.

I tried something like this but it didn't compile (because im not a real coder :D )

if (ReefAngel.Relay.status(Port8) = Off)
{
ReefAngel.Relay.Off(Port7);
}

Thanks.

Jeremiah

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 6:28 pm
by rimai
Try this:

Code: Select all

ReefAngel.Relay.Set(Port7,ReefAngel.Relay.Status(Port8));

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 7:09 pm
by aranax
Thanks Robert but that won't work for what I need (sorry I wasn't very clear :D).

I need a failsafe to where my recirculating skimmer pump WON'T turn on (or stay on) if my Return pump is OFF. However, there are times where the Return will be ON but I want the Skimmer OFF so I can't tie the status to each other in absolute terms. Just tied together if the Return is OFF. Any ideas? Thanks.

Jeremiah

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 7:25 pm
by lnevo
Your original code was perfect except for two things...

status should be Status and = should be ==

Try that.

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 7:40 pm
by aranax
Thanks Lee. I get:

Lees_altered.cpp: In function 'void loop()':
Lees_altered:329: error: 'Off' was not declared in this scope

when I try to compile.

if (ReefAngel.Relay.Status(Port7) == Off)
{
ReefAngel.Relay.Off(Port5);
}

BTW...Happy Holidays guys. Thanks for responding given this time of year. You guys ROCK!

Jeremiah

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 10:30 pm
by rimai
Try == 0 instead of == Off

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 10:46 pm
by aranax
Thanks Roberto. I tried that earlier and it compiled but functionality-wise it didn't work.

Jeremiah

Re: Link status of two different ports

Posted: Tue Dec 24, 2013 11:12 pm
by aranax
so weird...not ruling out user error but...

== 0 compiles but doesn't work.
!= 1 compiles and works fine.

Guess this is closed for now. Thanks guys.

Link status of two different ports

Posted: Wed Dec 25, 2013 5:51 am
by lnevo
If the port is in Auto mode it will be status 2...maybe?