Jump to content
C4 Forums | Control4

Help with multiple tap programming of single switch


fdastoor

Recommended Posts

I would like a switch in the Fam room upstairs to turn on and off a theatre downstairs with a double and triple tap.

I know how to program the multiple taps using a 'number' variable.

The double tap works in turning on the theater.

The triple tap does not execute.

I have tried to use a Stop and Break commands between the two parts of the script but it does not work.

Can someone please help?

Link to comment
Share on other sites


When Light Bottom Button Pushed

Variables> Double Tap = Variables>DoubleTap + 1

When Light Bottom Button is Released

Delay 500 milliseconds

If Variables>Double Tap=2

Send Command 'Control4 to Theater

Variables>Double Tap=0

Stop

Delay 500 milliseconds

If Variables>Double Tap=3

Turn of Theater

Variables>Double Tap=0

Link to comment
Share on other sites

Dont do your execution on the release... instead, put your code under the variable and include a 1 or 2 second delay.

When bottom button is pushed

Variables> doubletap = doubletap +1

When variables doubletap changes

Delay 1 second

If Variables>Double Tap=2

Send Command 'Control4 to Theater

If Variables>Double Tap=3

Turn off Theater

Variables>Double Tap=0

Link to comment
Share on other sites

When Light Bottom Button Pushed

Delay 500 milliseconds

If Variables>Double Tap=2

Send Command 'Control4 to Theater

Variables>Double Tap=0

Stop

Delay 500 milliseconds

If Variables>Double Tap=3

Turn of Theater

Variables>Double Tap=0

Problem is you're not in the sub-loop for the STOP command. It should look like this:

If Variables>Double Tap=2

Send Command 'Control4 to Theater

Variables>Double Tap=0

Stop

If Variables>Double Tap=3

Turn of Theater

Variables>Double Tap=0

Stop

The way you have it - if the double tap doesn't = 2 it still sets the variable to 0 and then stops - so it never gets to comparing the double tap 3 parameter.

Link to comment
Share on other sites

Dont do your execution on the release... instead, put your code under the variable and include a 1 or 2 second delay.

Though there are many ways to do everything, the example he used (and I fixed) is the "BEST PRACTICE" way that has been show to dealers in various classes.

Link to comment
Share on other sites

Dont do your execution on the release... instead' date=' put your code under the variable and include a 1 or 2 second delay.[/quote']

Though there are many ways to do everything, the example he used (and I fixed) is the "BEST PRACTICE" way that has been show to dealers in various classes.

Even though C4 teaches this, I still think that doing the execution under the variable works the best. I've never had any problem doing that way. To each their own, but I will continue to do what works best.

Link to comment
Share on other sites

Slemay, any idea why the official best practice is to put the programming in the button instead of in the variable? I've been trying to move more of my prorgamming into variables just to make it 1) easier to find and 2) easier to execute from multiple places. In the situation above, for example, having all the programming in the doubletap variable would mean that executing it from another switch would just involve adding a single line of code to the second place I want to use it, instead of having to recreate the whole program.

Is there an advantage to putting it in the light switch?

--Jason

Link to comment
Share on other sites

Dont do your execution on the release... instead' date=' put your code under the variable and include a 1 or 2 second delay.[/quote']

Though there are many ways to do everything, the example he used (and I fixed) is the "BEST PRACTICE" way that has been show to dealers in various classes.

Even though C4 teaches this, I still think that doing the execution under the variable works the best. I've never had any problem doing that way. To each their own, but I will continue to do what works best.

Matt's way definitely works. I had the same issue as the OP, and had code exactly like Slemay's that wouldn't work. It looks good on paper, but doesn't execute. Matt's works perfectly.

Link to comment
Share on other sites

Trip - must be something else in your programming that's wrong - I've done it "my" way 100's of times now and NEVER had an issue yet.

Jason & Matt - yes... as I stated - there are multiple ways to do it - and no way is better than the other. I can agree that if I have to call the program from multiple locations, it makes more sense to put it on the variable. In our case - we may use double taps on a bunch of keypads around the house and to keep clutter down in the programming - we use the same variable between all of them (what are the chances that two people in 500 ms are going to be double tapping at the same time???). Plus - I find it easier to find programming on the lights themselves then to go back and check it a variable.

But - I think the real lesson here is find a method that works for you and stick with it! Don't use both! As a year or two from now, you come back to that program, you won't remember where or what or even HOW you did something.

Good luck!

Shawn

Link to comment
Share on other sites

I don't think so man, I know I had done it that way previously as well, and for whatever reason it would work this time. if you'll recall, I even posted screen shots to prove that my code was literally exactly the same as yours, and I still couldn't get it to work.

Not saying that you're wrong, because as i said, i swear I had previously programmed systems like that, it just didn't work this time around

Link to comment
Share on other sites

  • 1 month later...

After you set up your variable,

GO to the programming tab and highlight the button of choice.

select on press

on the right hand side of the screen scroll down to variable and select your variable

below set to value

is set to random

below that is dropdown box that will allow you to select +

select that one

Link to comment
Share on other sites

^dogdvr- I think this is where I'm having probs. Using MacBook with Bootcamp and 3rd party utility for right-click mouse. I can't get that indent function to work so basically it's blowing past the "if" statement and going straight to the first executable line of code and then stopping. No further comparing of the var. past the first stop. Not at the computer with CHE installed otherwise I'd do th escreenshot for you. I really appreciate your responding to me and sorry for sorta highjacking you fdastoor!

Link to comment
Share on other sites

There have been so many posts regarding double and triple taps as well as hold commands. It is such a popular command why dont they just make a standard programming tool for this? It seems just adding to the standard press and release commands for programming there could be a radio button for a double tap or hold function. I would think this would make it easier for everybody.....? It just seems like this could be done with a standard built in functionality. Since my house has 70+ switches and keypads I think my dealer spent more time programming holds and multiple taps then anything else. Is there a plan to make a change like this to composer? And if so that would be great to have in the home version to make quick changes.

Link to comment
Share on other sites

While, I can see your point, what do you want the program to do?

Double tap on the Garage = what

Double tap ont the Kitchen = What

triple tap = what????

I hope you see what I mean, if you want flexiblilty you need to have some hard programming

Brent

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.