I/O Code Question

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
ewaldsreef
Posts: 82
Joined: Tue Oct 08, 2013 8:22 pm
Location: Salt Lake City, UT
Contact:

I/O Code Question

Post by ewaldsreef »

Thank you in advance for any help.
After adding this into the code how can I turn on the buzzer (located in the actinic port)? Based off of a given channel turning on of off?

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;
Also I have this code on my unit and would like to replicate the same thing for a customer. Instead of using the ato port I would like to use port 0 on the IO. The purpose is to shut off port 1 when a float in the overflow is activated and set the alarm.

Code: Select all

// High Float for Overflow
  if (ReefAngel.HighATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port1);
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    alert=true;
  }
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: I/O Code Question

Post by rimai »

This is how to turn the buzzer on:

Code: Select all

if (ReefAngel.CustomVar [0]>0)
  ReefAngel.PWM.SetActinic(100);
else
  ReefAngel.PWM.SetActinic(0);
And this is how to use the channel 0 of I/O:

Code: Select all

 
  if (ReefAngel.IO.GetChannel(0)) 
  {
    ReefAngel.Relay.On(Port1);
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    alert=true;
  }
Roberto.
Post Reply