I/O Expansion module code

Do you have a question on how to do something.
Ask in here.
Post Reply
Armetas
Posts: 82
Joined: Sat Mar 29, 2014 1:55 pm

I/O Expansion module code

Post by Armetas »

Hi,

I've bought I/O expansion module, but after connecting it I don't know what to do next...

I have 5 float switches. I will use them to monitor all my tank water levels.

1 - Low
2 - High
3 - Low
4 - High
5 - Low

Now I don't know how to add custom screen to my RA and how to setup such functionality for float switches.
So basically what I need:

1) code which will add new page in my current screen
2) code which control float switches as mentioned above

Maybe someone can help?

Thanks in advance.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: I/O Expansion module code

Post by rimai »

The new 2014 screen adds it automatically. Place this in your setup():

Code: Select all

  ReefAngel.Use2014Screen();
Then, use something like this in loop():

Code: Select all

ReefAngel.CustomVar [0]=0; // Initial value. Anything other than 0 means an alert.
ReefAngel.CustomVar [7]=255; // This is a dummy to make sure the Custom Variables is always enabled in the Portal 
if ( ReefAngel.IO.GetChannel(1) ) ReefAngel.CustomVar [0]=1;
if ( !ReefAngel.IO.GetChannel(2) ) ReefAngel.CustomVar [0]=2;
if ( ReefAngel.IO.GetChannel(3) ) ReefAngel.CustomVar [0]=3;
if ( !ReefAngel.IO.GetChannel(4) ) ReefAngel.CustomVar [0]=4;
if ( ReefAngel.IO.GetChannel(5) ) ReefAngel.CustomVar [0]=5;
In the portal, you can set a trigger for C0>0.
Roberto.
Armetas
Posts: 82
Joined: Sat Mar 29, 2014 1:55 pm

Re: I/O Expansion module code

Post by Armetas »

Thanks. And how to change labels for I/O channels?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: I/O Expansion module code

Post by rimai »

In the portal or in the screen?
Roberto.
Armetas
Posts: 82
Joined: Sat Mar 29, 2014 1:55 pm

Re: I/O Expansion module code

Post by Armetas »

In the screen
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: I/O Expansion module code

Post by rimai »

Sorry, not available yet :(
Can you create an issue request on our github, so we can work on this for future releases?
https://github.com/reefangel/libraries/issues/
Roberto.
Post Reply