Error Log/LEDs

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Error Log/LEDs

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

Re: Error Log/LEDs

Post by rimai »

I don't see anything wrong with if/then statements.
Roberto.
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: Error Log/LEDs

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

Re: Error Log/LEDs

Post 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);
Roberto.
Post Reply