# Single button, multiple press options (New thread see link in first post)

**URL:** <https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559>\
**Category:** General\
**Created:** [19 January 2020 06:52 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559 "2020-01-19T06:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 January 2020 06:52 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/1 "2020-01-19T06:52:47Z")

</div>

New thread:  
[See here.](https://discourse.nodered.org/t/how-to-detect-multiple-preses-on-a-single-button/20560)

Going on slightly from another thread with temperatures and alarms, it is interesting that I now have a similar question:

 ![Screenshot from 2020-01-19 17-48-55](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/0/b01ba4e434230bfdebae303c7c707a233d0666f8.png)

This flow _works_ in that I have to press the button (start) 4 times to get an `ACTION!`

Pretty easy in retrospect to what @Andrei posted in the other thread.

Ok, so this works.

My _quest_ is that it can also detect a **single** press.

I'll be thinking about it in the mean time, but I am just not getting something in how to let it do either a **single** or multiple presses.

```auto
[{"id":"9a9ece0e.e21968","type":"inject","z":"710ca09a.8302a8","name":"Start","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":490,"y":710,"wires":[["baa481f7.8c92f","d4d7fd43.e18b5"]]},{"id":"baa481f7.8c92f","type":"counter","z":"710ca09a.8302a8","name":"","init":"0","step":"1","lower":null,"upper":null,"mode":"increment","outputs":"1","x":676.6666870117188,"y":708.888916015625,"wires":[["18632614.5474e2","cdc2f3f7.8cd668"]]},{"id":"d4d7fd43.e18b5","type":"trigger","z":"710ca09a.8302a8","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"15","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":656.6666870117188,"y":768.888916015625,"wires":[["47f8333.7595f4c"]]},{"id":"18632614.5474e2","type":"debug","z":"710ca09a.8302a8","name":"RAW","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":816.6666870117188,"y":618.888916015625,"wires":[]},{"id":"cdc2f3f7.8cd668","type":"switch","z":"710ca09a.8302a8","name":"count presses","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"4","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":846.6666870117188,"y":708.888916015625,"wires":[["b04381cc.95e9c"]]},{"id":"47f8333.7595f4c","type":"change","z":"710ca09a.8302a8","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"foo","tot":"str"},{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":816.6666870117188,"y":768.888916015625,"wires":[["b04381cc.95e9c","baa481f7.8c92f"]]},{"id":"b04381cc.95e9c","type":"trigger","z":"710ca09a.8302a8","op1":"","op2":"ACTION","op1type":"nul","op2type":"str","duration":"10","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":1066.6666870117188,"y":708.888916015625,"wires":[["6419695d.f444a8"]]},{"id":"46bb072c.9ab548","type":"inject","z":"710ca09a.8302a8","name":"Reset","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"0.5","x":656.6666870117188,"y":818.888916015625,"wires":[["47f8333.7595f4c"]]},{"id":"6419695d.f444a8","type":"debug","z":"710ca09a.8302a8","name":"ACTION!","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1226.6666870117188,"y":708.888916015625,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 January 2020 10:42 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/2 "2020-01-19T10:42:47Z")

</div>

How would you tell if you made two single presses or if the two presses were ment to be tgether? you will need to define something like:  
If the button is pressed more than once in N seconds it is a multiple press  
else it is a single press.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 January 2020 10:45 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/3 "2020-01-19T10:45:47Z")

</div>

Ah!

You may want to take a peek at my other _shared flow_ which I subsequently posted.

I hope it is better than this effort.

[This one](https://discourse.nodered.org/t/how-to-detect-multiple-preses-on-a-single-button/20560/2)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [19 January 2020 11:01 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/4 "2020-01-19T11:01:15Z")

</div>

If you have created another thread that superceeds this one, then please make it known in the title so people won't waste their time looking at this one.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [19 January 2020 11:03 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/5 "2020-01-19T11:03:41Z")

</div>

I hope that is good enough.

I don't exactly know exactly how to do what you are suggesting.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [19 January 2020 11:53 UTC](https://discourse.nodered.org/t/single-button-multiple-press-options-new-thread-see-link-in-first-post/20559/6 "2020-01-19T11:53:10Z")

</div>


