Page 1 of 1

Error Log/LEDs

Posted: Mon Mar 24, 2014 4:15 pm
by jsclownfish
For awhile now, I've wanted to us the IO module to trigger a series of LEDs on the tank stand. I wanted to put 3 LEDs on the cabinet (red/yellow/green) and trigger a color change when something was out of spec. (Temp, ATO errors, water level, pH, etc) That way I can see from across the room if anything is off. I suppose I could run a series of if/then statements, but that doesn't seem very efficient. I thought I could then trigger a memory space to change at a specific location, but then everything in spec would keep correcting the change if the error triggers a change. Maybe I could use a series of memory locations and then query all of them to see if anything in that memory range has changed? Is there a better way to do this?

Thanks for the advice,
Jon

Re: Error Log/LEDs

Posted: Mon Mar 24, 2014 4:27 pm
by rimai
I don't see anything wrong with if/then statements.

Re: Error Log/LEDs

Posted: Mon Mar 24, 2014 4:40 pm
by jsclownfish
So if I want to check say 10 things (water level, ATO, pH, Temps, Flows, etc), would I just have a long cascade of if, else if, else if...?

-Jon

Re: Error Log/LEDs

Posted: Mon Mar 24, 2014 5:17 pm
by rimai
Pretty much, but it also depends on which color you want to light up with what parameter.
The way I would do is probably like this:

Code: Select all

boolean RedLEDStatus=false;
if (ReefAngel.Params.Temp[T1_PROBE]>810) RedLEDStatus=true;
if (ReefAngel.Params.PH>840) RedLEDStatus=true;
if (!ReefAngel.HighATO.IsActive()) RedLEDStatus=true;
digitalWrite (RedLEDPin,RedLEDStatus);