Curtain logic

Discussion in 'Pascal Logic Code Examples' started by gerald kiu, Jun 19, 2019.

  1. gerald kiu

    gerald kiu

    Joined:
    Jun 19, 2019
    Messages:
    2
    Likes Received:
    0
    Hi Guys. I'm stuck with writing a logic which require of toggle function

    when curtain at open position
    1st press to close
    2nd press to stop
    3rd press to open

    when curtain at close position
    1st press to open
    2nd press to stop
    3rd press to close

    when curtain at middle position
    1st press to close
    2nd press to stop
    3rd press to open
     
    gerald kiu, Jun 19, 2019
    #1
    1. Advertisements

  2. gerald kiu

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    930
    Likes Received:
    57
    Location:
    Adelaide, Australia
    Not much to go on here.

    What is the output unit? Shutter relay, cbus relay, 3rd party device?

    What device are you writing the logic for? Pascal or Lua?

    What device is triggering the logic?
     
    Ashley, Jun 19, 2019
    #2
    1. Advertisements

  3. gerald kiu

    gerald kiu

    Joined:
    Jun 19, 2019
    Messages:
    2
    Likes Received:
    0
    Hi Ashley. I'm using cbus relay with neo switch with 1 button toggle. Logic on pascal. It works like this.
    when the first press will be curtain open. Within 10s if the user press again will be curtain stop. If the user press after 10s will be curtain close

    once (GetLightingState("10_Curtain") = ON) then
    begin
    SetLightingState("1_Curtain Open", ON);
    Delay("0:00:01");
    SetLightingState("1_Curtain Open", OFF);
    end;

    once (GetLightingState("10_Curtain") = OFF) then
    begin
    SetLightingState("2_Curtain Close", ON);
    Delay("0:00:01");
    SetLightingState("2_Curtain Close", OFF);
    end;
     
    gerald kiu, Jun 20, 2019
    #3
    1. Advertisements

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.