# "Rpi-gpio in" node sending two messages

**URL:** <https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782>\
**Category:** General\
**Created:** [17 May 2021 12:36 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782 "2021-05-17T12:36:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [17 May 2021 12:36 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782/1 "2021-05-17T12:36:31Z")

</div>

Hi there,  
I am using a Rpi-Gpio-gpio in node. Is it normal that every time the button is pressed (once) the node send two messages with the same topic?  
{"topic":"pi/36","payload":0,"\_msgid":"ff149870.9f9ff8"}  
and  
{"topic":"pi/36","payload":1,"\_msgid":"efb09694.609518"}

Thanks

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [17 May 2021 12:48 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782/2 "2021-05-17T12:48:45Z")

</div>

If it's a momentary push button that is normal, you are getting a payload of 0 when you press, then when you release a payload of 1. What are you trying to achieve?

---

<div class="post-metadata">

**Author:** ![FeliceM](https://avatars.discourse-cdn.com/v4/letter/f/ec9cab/32.png) [@FeliceM](https://discourse.nodered.org/u/FeliceM)\
**Post date:** [17 May 2021 12:56 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782/3 "2021-05-17T12:56:18Z")

</div>

Thank you @ghayne.  
I am counting how many times the button is pressed to build an index to show different messages on a LCD.  
Since, in my case, it is not supposed to be pressed many times and fast, I can use a timer to drop the intermediate messages avoiding count double or use a function to count /2. I was interested in the behaviour of the node. You confirming that is correct. Happy with that.

Thanks

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [17 May 2021 12:58 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782/4 "2021-05-17T12:58:15Z")

</div>

You could also add a switch node to filter out the 0's and only pass the 1's.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 May 2021 12:58 UTC](https://discourse.nodered.org/t/rpi-gpio-in-node-sending-two-messages/45782/5 "2021-05-31T12:58:42Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
