IO Expansion

Do you have a question on how to do something.
Ask in here.

Posts: 166
Joined: Wed Nov 26, 2014 8:53 am
PostPosted: Sat Nov 19, 2016 6:41 pm
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

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Nov 19, 2016 7:39 pm
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.

Posts: 166
Joined: Wed Nov 26, 2014 8:53 am
PostPosted: Sat Nov 19, 2016 8:51 pm
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

Posts: 12200
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Nov 20, 2016 4:52 am
No. You need to implement your own countdown.
Roberto.

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 1 guest