Jump to content

How To Make Timed Button Press Program


plipof

Recommended Posts

Greetings-

 

Another user a while back spoke about making a program (or series of programs) where a button has to be pressed multiple times within a certain period of time in order for the program to activate (or deactivate) a certain device.

 

Below is an example of what I am trying to accomplish (it is also what the other user mentioned):

 

Press a keypad button ("Keypad Button") three times in succession to turn on a light.

If more than 5 seconds elapses between presses,

then the sequence resets and you have to start over.

I use something like this for my garage door open programming: it prevents the door from opening if you happen to hit the KPL button by accident. You can also have a little fun with this idea, for example, turning the aux buttons of a KPL into a combination lock.

 

Please help! I did not completely understand the other users post and I am hoping someone here can give me a hand. I am learning more and more everyday about the ISY and its interface and it is really amazing. If only it had the voice of Majel Roddenberry.

Link to comment

This will give you a starting point. Integer variable PressCount is required. Program TimedPress counts the number of times KeypadLinc button B is pressed with less than 5 seconds between each button press. KeypadLinc button B is set for non-toggle On mode so each press generates an On command. When button B pressed 3 times with less than 5 seconds between each press Program TimedPress3 is invoked. Scene TimedPressTooLong has KeypadLinc button B as a Responder. If more than 5 seconds passes the Integer variable PressCount is reset to 0 so count starts again and button B is turned Off.

 

Program TimedPress

If
       Control 'KeypadLinc 8 Dim V40 / KeypadLinc 8 Dim V40 - B' is switched On
   And $PressCount < 2

Then
       $PressCount += 1
       Wait  5 seconds
       $PressCount  = 0
       Set Scene 'SceneTimedPressTooLong' Off

Else
       $PressCount  = 0
       Run Program 'TimedPress3' (If)

Program TimedPress3

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Send X10 'H5/On (3)'

Else
  - No Actions - (To add one, press 'Action')

Link to comment

Wow. I'm really impressed and really appreciative. How simple and clean. I had 6 programs and 3 variables to try and make it work. You made it really simple and I like the logic. Wow again. Thank you so much! If you are ever in South Florida I owe you a drink (or two or 3)!

 

-Paul

Link to comment

You are very welcome. You may want to consider turning the KeypadLinc button Off from the second Program after performing whatever it is with the 3 button press. The same Scene the first Program used to turn the button Off if 5 seconds exceeded can be used in the second Program.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...