Link status of two different ports

Do you have a question on how to do something.
Ask in here.
Post Reply
aranax
Posts: 120
Joined: Thu Jun 02, 2011 11:54 pm

Link status of two different ports

Post 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
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Link status of two different ports

Post by rimai »

Try this:

Code: Select all

ReefAngel.Relay.Set(Port7,ReefAngel.Relay.Status(Port8));
Roberto.
aranax
Posts: 120
Joined: Thu Jun 02, 2011 11:54 pm

Re: Link status of two different ports

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

Re: Link status of two different ports

Post by lnevo »

Your original code was perfect except for two things...

status should be Status and = should be ==

Try that.
aranax
Posts: 120
Joined: Thu Jun 02, 2011 11:54 pm

Re: Link status of two different ports

Post 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
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Link status of two different ports

Post by rimai »

Try == 0 instead of == Off
Roberto.
aranax
Posts: 120
Joined: Thu Jun 02, 2011 11:54 pm

Re: Link status of two different ports

Post by aranax »

Thanks Roberto. I tried that earlier and it compiled but functionality-wise it didn't work.

Jeremiah
Image
aranax
Posts: 120
Joined: Thu Jun 02, 2011 11:54 pm

Re: Link status of two different ports

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

Link status of two different ports

Post by lnevo »

If the port is in Auto mode it will be status 2...maybe?
Post Reply