DLT label changing with scene selection

Discussion in 'Pascal Logic Code Examples' started by Adam McLeod, Dec 1, 2009.

  1. Adam McLeod

    Adam McLeod

    Joined:
    Sep 16, 2009
    Messages:
    9
    Likes Received:
    0
    Location:
    Adelaide
    Hi all,

    I have a question controlling 3 speed fan with a DLT switch.

    Because you have no LED control with a DLT i thought it would be nice to be able to get the labels to change as to what speed setting the fan was currently on.

    Each time the DLT button is pressed a new scene is triggered, starting at low, then, meduim, then high, then off.

    Here is my logic attempt but i don't seem to be able to get it to work, can anyone help me out with this, cheers

    My C-Bus switch is labelled "Bed 1 sweep fan control"

    Constants:
    net = 254;
    app = 56;

    Global Variables:
    CounterFanBed1 : integer;

    Initialisation:
    CounterFanBed1 := 0;
    SetIntIBSystemIO("Label Language",2);

    once (GetLightingState("Bed 1 sweep fan control") = OFF) then
    begin
    CounterFanBed1 := CounterFanBed1 + 1;
    SetLightingState("Bed 1 sweep fan control", ON);
    case CounterFanBed1 of
    0 : ;
    1 : SetScene("Bedroom 1 Sweep Fan Low");
    2 : SetScene("Bedroom 1 Sweep Fan Med");
    3 : SetScene("Bedroom 1 Sweep Fan High");
    4 : SetScene("Bedroom 1 Sweep Fan Off");
    end
    end;

    if CounterFanBed1 >= 4 then
    begin
    CounterFanBed1 := 0;
    end;

    once CounterFanBed1 = 1 then
    begin
    SetStringIBSystemIO("Label Group Text", net, app, 157, 0, 'Fan Low');
    end;

    once CounterFanBed1 = 2 then
    begin
    SetStringIBSystemIO("Label Group Text", net, app, 157, 0, 'Fan Med');
    end;

    once CounterFanBed1 = 3 then
    begin
    SetStringIBSystemIO("Label Group Text", net, app, 157, 0, 'Fan High');
    end;

    once CounterFanBed1 = 4 then
    begin
    SetStringIBSystemIO("Label Group Text", net, app, 157, 0, 'Fan Off');
    end

    Cheers for your help
     
    Adam McLeod, Dec 1, 2009
    #1
  2. Adam McLeod

    dic

    Joined:
    Sep 17, 2008
    Messages:
    9
    Likes Received:
    1
    You don't need to put the dlt labelling in separate if/once statements. Just combine in with the case statement. Here is my version (I think I robbed this from someone else on the fourm and modified to suit).

    My DLT button is programmed as a preset to 255. The logic sees this and does it thing, then sets the group to a level of 10%. This keeps the led on the button ON (to show the fan is on), but allows the preset to be sent out again if the button is pressed again to change fan speed. Once the counter gets to 4 (fan = off), the logic then sets the group to 0% and thus the led turns off too.


    Global Variable:
    CounterFan : integer;

    Initialisation:
    CounterFan := 0;
    SetIntIBSystemIO("Label Language", 2);

    once (GetLightingState("FanControl") = OFF) then
    begin
    CounterFan := 0;
    SetScene("Fan Off");
    end;

    if(GetLightingLevel("Fancontrol") = 255) then
    begin
    CounterFan := CounterFan +1;
    SetLightingLevel("FanControl", 10%, "0s");
    case CounterFan of
    1 : begin
    SetScene("Fan High");
    SetStringIBSystemIO("Label Group Text", "Local", "Lighting", "FanControl", 0, 'Fan Med');
    end;
    2 : begin
    SetScene("Fan Medium");
    SetStringIBSystemIO("Label Group Text", "Local", "Lighting", "FanControl", 0, 'Fan Low');
    end;
    3 : begin
    SetScene("Fan Low");
    SetStringIBSystemIO("Label Group Text", "Local", "Lighting", "FanControl", 0, 'Fan OFF');
    end;
    4 : begin
    SetScene("Fan Off");
    SetStringIBSystemIO("Label Group Text", "Local", "Lighting", "FanControl", 0, 'Fan High');
    end;
    5 : CounterFan :=0;
    end;
    end;

    if CounterFan >= 4 then
    begin
    CounterFan := 0;
    SetLightingState("FanControl", OFF);
    end;
     
    Last edited by a moderator: Dec 1, 2009
    dic, Dec 1, 2009
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.