# Multiple gpio with function

**URL:** <https://discourse.nodered.org/t/multiple-gpio-with-function/24666>\
**Category:** General\
**Created:** [11 April 2020 19:27 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666 "2020-04-11T19:27:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![stinggray](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@stinggray](https://discourse.nodered.org/u/stinggray)\
**Post date:** [11 April 2020 19:27 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666/1 "2020-04-11T19:27:15Z")

</div>

I have a newbe question.

I'm setting up a dashboard to monitor liquid in tanks. I will use 4 sensors to a digital pin on an Arduino then to rpi. In node-red after receiving the gpio If it's high I change it to .20, so I ether a 0(low) or .20(high) from each gpio after the changes. Here is where I stuck. How do I add the 4 gpio in the function node and get a total msg.payload?

 ![Annotation 2020-04-11 152618](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/437b3195cac8ca99142a90192a957d5f88ae14d9.jpeg)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 April 2020 20:58 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666/2 "2020-04-11T20:58:30Z")

</div>

Have a look at [this post from the cookbook](https://cookbook.nodered.org/basic/join-streams) for how to combine data from different streams

---

<div class="post-metadata">

**Author:** ![stinggray](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@stinggray](https://discourse.nodered.org/u/stinggray)\
**Post date:** [12 April 2020 02:43 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666/3 "2020-04-12T02:43:03Z")

</div>

I looked at the join and that's not what I need to do with the data. Here is a scenario I'm trying to do. Lets say two of the sensors on the tank are high and each one has been changed to .2 I need to add (.4 = .2 + .2) and enter the .4 into a dashboard gauge. I'm just sure how this done in the function node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 April 2020 06:07 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666/4 "2020-04-12T06:07:05Z")

</div>

Did using the join node solve the first part of the problem, which is to get both values in one message?

Edit: Once you have both the numbers available then the rest is easy.

---

<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:** [11 June 2020 06:19 UTC](https://discourse.nodered.org/t/multiple-gpio-with-function/24666/5 "2020-06-11T06:19:08Z")

</div>

Closed on 11 June 2020 06:19 UTC

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