fdastoor Posted October 30, 2008 Share Posted October 30, 2008 What are the steps for a Press and Hold sequence? I know how to do the double or triple tap but am stumped by the hold step Link to comment Share on other sites More sharing options...
AS2 Posted October 30, 2008 Share Posted October 30, 2008 off the top of my head, you could do it this way...- make a Boolean variable call HOLD BUTTON 1 - program "when Button 1 is PRESSED" > SET VARIABLE HOLD BUTTON 1 to TRUE- program "when Button 1 is RELEASED" > SET VARIABLE HOLD BUTTON 1 to FALSE- now you can tie programming to the status of the VARIABLE, so when that variable equals TRUE, you can program whatever you want for when the button is pressedthere is probably a better way to do it, but it sort of depends on what you want to press to hold. Link to comment Share on other sites More sharing options...
neil12011 Posted October 30, 2008 Share Posted October 30, 2008 this is a good situation to use a loop.make a boolean as stated, but also make a number variable and use a loop.the loop would look like: while "whatevervariable" is true, delay 1 second and +1 the variable...basically while it's being held every second it increments it by 1, and when it hits whatever number of seconds you want, if "whatevervariable" =X then execute whatever programming. I'll post examples later if need be. Link to comment Share on other sites More sharing options...
RyanE Posted October 31, 2008 Share Posted October 31, 2008 If you're using 1.6 or later, the best way to do hold is with a Timer.When top button pressed, reset timer (timer interval = 1 or 2 seconds, how long you want to have to hold before your programming goes.) -- reset restarts the timer from 0When top button released, stop timer.When timer expires, do your hold programming.Simple, no loops, and no variables, other than the timer.RyanE Link to comment Share on other sites More sharing options...
TurboKuake Posted October 31, 2008 Share Posted October 31, 2008 This works well...http://www.c4forums.com/viewtopic.php?id=2168 Link to comment Share on other sites More sharing options...
punkrock Posted November 3, 2008 Share Posted November 3, 2008 If you're using 1.6 or later, the best way to do hold is with a Timer.When top button pressed, reset timer (timer interval = 1 or 2 seconds, how long you want to have to hold before your programming goes.) -- reset restarts the timer from 0When top button released, stop timer.When timer expires, do your hold programming.Simple, no loops, and no variables, other than the timer.RyanEthis opens up so many kewl opportunities for programming... to test this, I just set up my simple light switch in the entry way to to arm the security after a 8 second hold. (and turn off the screen savers on the 10 inch panels)... it seems to work great so far! Link to comment Share on other sites More sharing options...
RyanE Posted November 3, 2008 Share Posted November 3, 2008 As long as you don't set it up to *disarm* after 8 seconds.A really patient thief gets all your stuff...RyanE Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.