Blind controls
nds2006
Posts: 10
Hi,
I am looking to have 5 sets of blinds controlled via relays, with 5 buttons that select which blinds to operate and then open and close buttons to pulse the equilivant relays that have been selected from the above buttons.
I am using "Select and Active" to determine which buttons are active for the single blind control, but not sure what the best way to trigger the relays on the various combinations of selections. i know i could use "if" statements for all combinations, but would pefer a more efficient way.
Any help appreciated
Regards,
Noel
I am looking to have 5 sets of blinds controlled via relays, with 5 buttons that select which blinds to operate and then open and close buttons to pulse the equilivant relays that have been selected from the above buttons.
I am using "Select and Active" to determine which buttons are active for the single blind control, but not sure what the best way to trigger the relays on the various combinations of selections. i know i could use "if" statements for all combinations, but would pefer a more efficient way.
Any help appreciated
Regards,
Noel
0
Comments
Variable population
Blind control function
I'd do something like this: Note - I haven't tested this.
Perhaps we're not on the same page either though, so I could be doing something here you don't want to do.
Basically, you select which ones you wish to control, then hit the up or down button, and it does those ones that are selected. That's what you're trying to accomplish right?
JJames, Yes that is what i am looking to do, select the blind buttons and then use open and close.
I have tested you example and it does not seem to be just right.
The nSELECTED_RELAY variable is not storing which buttons have been selected.
BUTTON_EVENT[tp,nRELAY_SELECT_BTNS]
{
PUSH:
{
nSELECTED_RELAY[get_last(nRELAY_SELECT_BTNS)] = !nSELECTED_RELAY[get_last(nRELAY_SELECT_BTNS)]
}
}
This is what I have in the code, can you explain what the ! is doing??
Regards,
Noel
I don't have access to a processor right now - but are you watching the variable to see if it changes?
You could add a LOCAL_VAR in that button event, and give it the value of GET_LAST(nRELAY_SELECTED_BTNS) and watch the value to make sure it's changing. I'm sure I'm missing something or doing something really stupid . . . I just can't see it.
Can you make it more simple??
I normally do it in this way, a single button for each blind that does all; Open, Close, Stop, No need to select.
If the variable declaration is changed to this then all will be good.
nSELECTED_RELAY[4] = {0,0,0,0}
You don?t have to initialize the array in the declaration as I suggested but somewhere in the code the length has to be set. You could also do something like this by using direct assignment:
DEFINE_START
nSELECTED_RELAY = ?0,0,0,0?
or force the length like this:
DEFINE_START
SET_LENGTH_ARRAY(nSELECTED_RELAY,4)
But somewhere in code the length has to be set or the FOR loop won?t loop.
Regards,
Noel