# Node-red rf button multifunction single/double/triple press

**URL:** <https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182>\
**Category:** General\
**Created:** [16 September 2018 10:22 UTC](https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182 "2018-09-16T10:22:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lpt2007](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lpt2007](https://discourse.nodered.org/u/lpt2007)\
**Post date:** [16 September 2018 10:22 UTC](https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182/1 "2018-09-16T10:22:49Z")

</div>

How to make flow for rf button multifunction(single press/double press/triple press)?

my button sends command only when pressed.

Can someone show me example flow or share similar solution.

---

<div class="post-metadata">

**Author:** ![GChapo](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GChapo](https://discourse.nodered.org/u/GChapo)\
**Post date:** [16 September 2018 14:30 UTC](https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182/2 "2018-09-16T14:30:30Z")

</div>

Is the RF code different for each press?

---

<div class="post-metadata">

**Author:** ![lpt2007](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lpt2007](https://discourse.nodered.org/u/lpt2007)\
**Post date:** [19 September 2018 06:19 UTC](https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182/3 "2018-09-19T06:19:04Z")

</div>

No. Code is alway the same.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [19 September 2018 08:09 UTC](https://discourse.nodered.org/t/node-red-rf-button-multifunction-single-double-triple-press/3182/4 "2018-09-19T08:09:16Z")

</div>

I'm not sure about this completely, but something like this can be done

`[{"id":"3d20d166.20e64e","type":"function","z":"18c83e13.bcdd42","name":"Count clicks","func":"var count = context.get(\"count\") || 0;\n\nif(msg.count === count && count !== 0){\n context.set(\"count\",0);\n return [null,msg];\n}\n\nif(count < 3){\n if(msg.delay === undefined){\n count++\n context.set(\"count\",count);\n }\n msg.delay = true;\n msg.count = count;\n return [msg,null];\n}\n\n","outputs":2,"noerr":0,"x":430,"y":520,"wires":[["e24258f7.cf6408"],["91d1cd16.daa69"]]},{"id":"27f0311a.6bd7de","type":"inject","z":"18c83e13.bcdd42","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":520,"wires":[["3d20d166.20e64e"]]},{"id":"e24258f7.cf6408","type":"delay","z":"18c83e13.bcdd42","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":430,"y":420,"wires":[["3d20d166.20e64e"]]},{"id":"91d1cd16.daa69","type":"debug","z":"18c83e13.bcdd42","name":"output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":540,"wires":[]}]`
