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
  2. gerald kiu

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,524
    Likes Received:
    173
    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
  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
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.