IO Expansion

Do you have a question on how to do something.
Ask in here.
Post Reply
Lionfan
Posts: 166
Joined: Wed Nov 26, 2014 8:53 am

IO Expansion

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

Re: IO Expansion

Post 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();
Roberto.
Lionfan
Posts: 166
Joined: Wed Nov 26, 2014 8:53 am

Re: IO Expansion

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

Re: IO Expansion

Post by rimai »

No. You need to implement your own countdown.
Roberto.
Post Reply