Page 1 of 1

IO Expansion

Posted: Sat Nov 19, 2016 6:41 pm
by Lionfan
I'm sure this has been answered, but I can't figure out how to make a good IO Expansion code.

What I have is two hard switches that I would like to do a few things.
Switch one: lights on mode,
Switch two: water-change mode, but resets after about 5 minutes (in case the switch is left in the on position)

I also would like one of the IO ports to send me n email if activated (high water level in filter sock section)

I think after I get those codes, I should be able to deduce how to write new code for it. Just not sure on how to begin.


Thanks in advance for the help!

Re: IO Expansion

Posted: Sat Nov 19, 2016 7:39 pm
by rimai
Use momentary switches.
That way you never take the risk of leaving it on.

Code: Select all

if (ReefAngel.IO.GetChannel(0)) ReefAngel.LightsOn();
if (ReefAngel.IO.GetChannel(1)) ReefAngel.WaterChangeModeStart();

Re: IO Expansion

Posted: Sat Nov 19, 2016 8:51 pm
by Lionfan
rimai wrote:Use momentary switches.
That way you never take the risk of leaving it on.

Code: Select all

if (ReefAngel.IO.GetChannel(0)) ReefAngel.LightsOn();
if (ReefAngel.IO.GetChannel(1)) ReefAngel.WaterChangeModeStart();
Thanks!
Good point on the momentary switches. That's what I have on the HighAto port to get it into water change mode.
If it's a momentary switch, will the RA count down before it resets to normal mode?

Re: IO Expansion

Posted: Sun Nov 20, 2016 4:52 am
by rimai
No. You need to implement your own countdown.