Key Tracking

Discussion in 'C-Touch/HomeGate/SchedulePlus/PICED Software' started by Weedo, May 12, 2013.

  1. Weedo

    Weedo

    Joined:
    Mar 21, 2011
    Messages:
    35
    Likes Received:
    3
    Location:
    Toowoomba
    How if possible can you detect when a key has been pressed via logic and execute a command? I.e if Wall switch in Lounge, (key 2) is pressed once turn on light 1. If lounge (key 2) is pressed twice turn on light 2 and if pressed three times turn off both lights??
     
    Weedo, May 12, 2013
    #1
  2. Weedo

    Roosta

    Joined:
    Nov 22, 2011
    Messages:
    560
    Likes Received:
    1
    Location:
    Australia
    The only way I believe you can achieve this is by utilising a counter of some sort..

    Here is a simple bit of code I wrote for simple 3 speed control from a DLT.. You should be able to apply this to your applications.. Also included DLT Labelling..

    Cheers.
     
    Roosta, May 12, 2013
    #2
  3. Weedo

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,548
    Likes Received:
    178
    Location:
    Adelaide, Australia
    The basic issue here is that logic can't detect when you press a switch, it can only detect changes in group levels. The trick is to set the switch up with the ON function only (i.e. when you press the switch the group is set on). In your logic, test for the ON level, do what you need to do, then set the group level back to zero in the logic.
    e.g.
    ONCE GetLightingLevel("Group")= 255) THEN
    begin
    {do logic here}
    Setlightinglevel("Group",0%,"0s");
    end;

    Don't be tempted to use the Bell Press function (that sets the group ON when you press the switch and OFF when you release it) because logic only runs every 200mS and you can easily miss the state change

    I generally prefer to use a different group address for triggering and for the actual light control, but Roosta's use of different group levels is equally valid.
     
    Ashley, May 13, 2013
    #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.