sscase Posted January 28, 2015 Share Posted January 28, 2015 I'm looking to set a status of a LED based on all the security zones. I want it to be red if a zone is open. My question is should I create a variable for each zone (basement window, kitchen window, mudroom window, office window, etc..) or create one variable with all of them in it? I'm guessing the answer will be to create a variable for each one so it provides me flexibility in programming other events. Thanks Link to comment Share on other sites More sharing options...
Cyknight Posted January 28, 2015 Share Posted January 28, 2015 If you're planning to have that one LED to turn red if any of those zones is open, you'd create one variable for that LED (not one for each zone).Variable would be number.When zone opens, +1When zone closes -1 If variable changesIF variable is greater than 0-set LED to REDIF variable is less then or equal to 0-set LED to Green-variable = 0 {just to prevent underruns} Link to comment Share on other sites More sharing options...
sscase Posted January 28, 2015 Author Share Posted January 28, 2015 Thanks, I understand the bottom part. However, how do I create the "zone open +1" and "zone closes -1"? Don't I need to create a variables (number) for each zone: Garage Door (number) variableKitchen Window (number) variableOffice Window (number) variable etc.. So, then under my "LED turn red variable" I have the following conditions: If Garage door is open-variable (garage) = +1If Garage door is closed-variable (garage) = -1etc.... I haven't done much with variables as numbers. Maybe this is the convoluted way of doing it, I would prefer simple and elegant. Thanks! Link to comment Share on other sites More sharing options...
Cyknight Posted January 28, 2015 Share Posted January 28, 2015 No, the variable you created is a number variable. Call it 'LED variable' When zone x opens (exact wording depends on sensor type)-variable [LED variable] +1 Reverse for close What this effectively does is when ANY of these zones is open - the LED is redIf ALL zones are closed, it's green. This, to my understanding is what you were looking for. Link to comment Share on other sites More sharing options...
sscase Posted January 28, 2015 Author Share Posted January 28, 2015 Aha, I got! Thanks Cy! Link to comment Share on other sites More sharing options...
cybuch Posted January 29, 2015 Share Posted January 29, 2015 I do it a different way, I create a macro and put the following in: ----------------------if window/door1 is open turn led redstop if window/door2 is openturn led redstop if window/door3 is openturn led redstop if window/door4 is open turn led redstop turn led green-------------------- Then I just call the macro from each window/door "When contact state changes". Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.