Jump to content
C4 Forums | Control4

Press and Hold


fdastoor

Recommended Posts


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 pressed

there 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

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

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 0

When 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

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 0

When top button released, stop timer.

When timer expires, do your hold programming.

Simple, no loops, and no variables, other than the timer.

RyanE

this 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

Archived

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.