# Thonny code to Node-Red

**URL:** <https://discourse.nodered.org/t/thonny-code-to-node-red/5875>\
**Category:** General\
**Created:** [17 December 2018 10:20 UTC](https://discourse.nodered.org/t/thonny-code-to-node-red/5875 "2018-12-17T10:20:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvarMvl](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@IvarMvl](https://discourse.nodered.org/u/IvarMvl)\
**Post date:** [17 December 2018 10:20 UTC](https://discourse.nodered.org/t/thonny-code-to-node-red/5875/1 "2018-12-17T10:20:14Z")

</div>

So im am using the code below in thonny and am now trying to make it in a Node-red flow .

I'm not really familiar with coding so I dont know how it all work.  
thank you in advance.

```
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)    
GPIO.setup(16,GPIO.IN)

try:
    while True:
    if GPIO.input(16)==0:
        print ("Open")
    else:
        print ("Closed")

finally:
    GPIO.cleanup()
```

---

<div class="post-metadata">

**Author:** ![IvarMvl](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@IvarMvl](https://discourse.nodered.org/u/IvarMvl)\
**Post date:** [17 December 2018 11:19 UTC](https://discourse.nodered.org/t/thonny-code-to-node-red/5875/2 "2018-12-17T11:19:41Z")

</div>

Already found it.  
I just seached in google
