screen relay issue
playskool1
Posts: 64
i know i have used this code before and worked fine. in this new project i have 4 screens controlled through relays. none are working. i know that the screens will go up and down if i short the wires.
the TP buttons feedback are all set to Momentary.
DEFINE_DEVICE dvRELAY = 5001:8:0 //Draper 104306L LVC Controller (x4) BUTTON_EVENT[dvTP_1189,50] BUTTON_EVENT[dvTP_1189,51] { PUSH: { PULSE[button.input.device, button.input.channel] IF (button.input.device = 50) PULSE[dvRelay,1] //Screen UP #1187 ELSE IF (button.input.device = 51) PULSE[dvRelay,2] //Screen DOWN #1187 } } BUTTON_EVENT[dvTP_1189,52] BUTTON_EVENT[dvTP_1189,53] { PUSH: { PULSE[button.input.device, button.input.channel] IF (button.input.device = 52) PULSE[dvRelay,3] //Screen UP #1188 ELSE IF (button.input.device = 53) PULSE[dvRelay,4] //Screen DOWN #1188 } } BUTTON_EVENT[dvTP_1189,54] BUTTON_EVENT[dvTP_1189,55] { PUSH: { PULSE[button.input.device, button.input.channel] IF (button.input.device = 54) PULSE[dvRelay,5] //Screen UP #1189 ELSE IF (button.input.device = 55) PULSE[dvRelay,6] //Screen DOWN #1189 } } BUTTON_EVENT[dvTP_1189,56] BUTTON_EVENT[dvTP_1189,57] { PUSH: { PULSE[button.input.device, button.input.channel] IF (button.input.device = 56) PULSE[dvRelay,7] //Screen UP #1190 ELSE IF (button.input.device = 57) PULSE[dvRelay,8] //Screen DOWN #1190 } }
the TP buttons feedback are all set to Momentary.
0
Comments
You probably want this instead:
If that?s true then the line below doesn?t do anything.
If you want to control the feedback you?ll need to set the feedback to Channel and when the button is pushed you can try a simpler method like this instead:
Or if you prefer:
And as an FYI, you can also consolidate your code considerably by doing something like this to control all the screens:
DEFINE_DEVICE
dvRELAY = 5001:8:0 //Draper 104306L LVC Controller (x4)
BUTTON_EVENT[dvTP_1189,50]
BUTTON_EVENT[dvTP_1189,51]
BUTTON_EVENT[dvTP_1189,52]
BUTTON_EVENT[dvTP_1189,53]
BUTTON_EVENT[dvTP_1189,54]
BUTTON_EVENT[dvTP_1189,55]
BUTTON_EVENT[dvTP_1189,56]
BUTTON_EVENT[dvTP_1189,57]
{
PUSH:
{
PULSE[dvRelay,BUTTON.INPUT.CHANNEL-49]
}
}
What Joe said was right also, same thing written a different way. You could probably write this same code 10 different ways and they would all be right and they would all work. This does not address feedback because typically with a screen you would want latching feedback to show the state of the screen. You also should have the pairs of relays defined mutually exclusive so you won't get both relays to turn on at the same time if the up and down buttons are pressed quickly.
with mutually exclusive relays, doesn't the last energized relay stay closed?
except if you use total_off, of course.
You're clearly correct. I didn't know that about mutually exclusive relays and pulse. I also never realized that relay feedback was different from relay status, but it is. I'm not sure what to make of this new knowledge. It seems troubling to me that by making relays mutually exclusive that the ability to query the status of the relays is lost, but perhaps that ability is superfluous.
As for having a screen control button stay lit -- we do a lot of screen controls and we've never done one that way. Typically we do screen control button feedback with a "to", screen status being self evident.
[edit]
Took a while, but found it, TOTAL_OFF. Awesome!
[/edit]