# Can't read GPIO without first running some python

**URL:** <https://discourse.nodered.org/t/cant-read-gpio-without-first-running-some-python/3806>\
**Category:** General\
**Created:** [9 October 2018 02:42 UTC](https://discourse.nodered.org/t/cant-read-gpio-without-first-running-some-python/3806 "2018-10-09T02:42:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abstract2Actual](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@Abstract2Actual](https://discourse.nodered.org/u/Abstract2Actual)\
**Post date:** [9 October 2018 02:42 UTC](https://discourse.nodered.org/t/cant-read-gpio-without-first-running-some-python/3806/1 "2018-10-09T02:42:55Z")

</div>

I created a simple flow that checks to see if a switch is depressed and deployed it, but it didn't work. Thinking that my GPIO was fried, i ran a little python script to read the same GPIO pin, The python script worked fine and could read the switch. When I went back to the node-red console, I saw that the flow was working. I made changes to the flow and deployed. It didn't work anymore. I ran the python script again and when I came back to the node red console, everything was magically working.  
Is there something I need to do in node red to initialize the pin similar to "GPIO.setup(21, GPIO.IN, pull\_up\_down=GPIO.PUD\_UP)" in Python? That is the python line of code that , when I execute it, the node red flow starts working  
Running Node-RED v0.19.4 on Pi Zero

---

<div class="post-metadata">

**Author:** ![Abstract2Actual](https://avatars.discourse-cdn.com/v4/letter/a/7feea3/32.png) [@Abstract2Actual](https://discourse.nodered.org/u/Abstract2Actual)\
**Post date:** [9 October 2018 04:05 UTC](https://discourse.nodered.org/t/cant-read-gpio-without-first-running-some-python/3806/2 "2018-10-09T04:05:40Z")

</div>

I figured out how to get it to work.  
I have a switch connected to GPIO 21 on one side, and ground on the other. I initially set the resistor type to pulldown when configuring the input node. Changing the resistor type to pullup and checking the read initial state checkbox resolved the issue.
