PDA

View Full Version : alternate control of 2 outputs.. blinds??


coppo
13 Apr 06, 10:58 AM
Application:
1 C-Bus button ( BlindSW , INPUT) controlling 2 output Group Addresses alternately.
( BlindUP... BlindDN, outputs)

PAC looks at the BlindSW GA for an ON state, depending upon the current state of the flag ( Blind1flag = ON ...OFF), then sends an ON command to either BlindUP or BlindDN.

When BlindSW GA = OFF, the flag is left in its current state ( ready to alternate the output next time) and both BlindUP ...BlindDN are reset.

The "auto resetting" of the BlindSW GA is done by you configuring your actual C-Bus wall switch to a "toggle timer" for a relevant timer.. 30Secs, 1 min .. whatever .

If you use a delay in the code it will in most cases cause odd operation,
unless you fully understand programming and modify your code appropriately.

If the output device has some odd configuration requirement, this code will
not work for you. ie: the blind needs both outputs "on" to stop. You will need to modify the codee to suit your application.


This code is suitable for PAC / ColourTouch / HomegateV3 / ScheduleplusV3.




{Global Variables section}
blind1flag, blind2flag : boolean;


{Initialisation section}
blind1flag := off;
blind2flag := off;

{Blind control Module}
{ DO NOT USE DELAYS in this module, it will have adverse affects and cause problems
with the rest of the code below it.}

{Blind1 UP and DOWN control}
{ Delays for auto reset of cbus "Blind1SW" button must be done via C-Bus timer in button itself }
once (GetLightingState("Blind1Sw") = ON) then
begin
if (blind1flag = OFF) then
begin
SetLightingState("Blind1DN", OFF);
SetLightingState("Blind1UP", ON);
blind1flag := ON;
end
else
begin
SetLightingState("Blind1Up", OFF);
SetLightingState("Blind1DN", ON);
blind1flag := OFF;
end;
end;

{Blind1 RESET}
once (GetLightingState("Blind1Sw") = OFF) then
begin
SetLightingState("Blind1DN", OFF);
SetLightingState("Blind1UP", OFF);
end;
{================================================= ======}

{Blind2 UP and DOWN control}
{ Delays for auto reset of "Blind2SW" c-bus button must be done via C-Bus timer in button itself }
once (GetLightingState("Blind2Sw") = ON) then
begin
if (blind2flag = OFF) then
begin
SetLightingState("Blind2DN", OFF);
SetLightingState("Blind2UP", ON);
blind2flag := ON;
end
else
begin
SetLightingState("Blind2Up", OFF);
SetLightingState("Blind2DN", ON);
blind2flag := OFF;
end;
end;

{Blind2 RESET}
once (GetLightingState("Blind2Sw") = OFF) then
begin
SetLightingState("Blind2DN", OFF);
SetLightingState("Blind2UP", OFF);
end;

Phil.H
14 Apr 06, 08:17 AM
Can you imagine how tricky things would be without "once" for C-Bus related code.

Darren - take the rest of the day off ;)