# How to create function on rpi node red with two gpio - if gpio1 == 1 && gpio2 ==0 then gpio3=1

**URL:** <https://discourse.nodered.org/t/how-to-create-function-on-rpi-node-red-with-two-gpio-if-gpio1-1-gpio2-0-then-gpio3-1/20406>\
**Category:** General\
**Created:** [15 January 2020 20:53 UTC](https://discourse.nodered.org/t/how-to-create-function-on-rpi-node-red-with-two-gpio-if-gpio1-1-gpio2-0-then-gpio3-1/20406 "2020-01-15T20:53:15Z")\
**Posts on this page:** 1\
**Showing post:** 27

<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:** [3 February 2020 08:47 UTC](https://discourse.nodered.org/t/how-to-create-function-on-rpi-node-red-with-two-gpio-if-gpio1-1-gpio2-0-then-gpio3-1/20406/27 "2020-02-03T08:47:10Z")

</div>

Ah the joy of javascript....  
your combined payloads look like this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c7d9bd4997d6e416be0221c3377f21a2dea5f1d7.png)  
all good so far  
Then your function does this  
if (msg.payload.pi/35 == 1 && msg.payload.pi/37 == 1) {

which is a natural thing to do... but javascript doesn't like / in property names so it will be treating it like a divide :-)... so instead you need to do

`if (msg.payload["pi/35"] == 1 && msg.payload["pi/37"] == 1) {`

---

_[View the full topic](https://discourse.nodered.org/t/how-to-create-function-on-rpi-node-red-with-two-gpio-if-gpio1-1-gpio2-0-then-gpio3-1/20406)._
