# Write to GPIO Pins in Perspective

**URL:** <https://forum.inductiveautomation.com/t/write-to-gpio-pins-in-perspective/52690>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 3, 2021, 7:54pm UTC](https://forum.inductiveautomation.com/t/write-to-gpio-pins-in-perspective/52690 "2021-11-03T19:54:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brit](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@Brit](https://forum.inductiveautomation.com/u/Brit)\
**Post date:** [November 3, 2021, 7:54pm UTC](https://forum.inductiveautomation.com/t/write-to-gpio-pins-in-perspective/52690/1 "2021-11-03T19:54:26Z")

</div>

Hi, I’m working on a Perspective project that needs to write to the GPIO pins of a RPi 4. When a tag is active, it writes a “1” to a specified pin number and when it is inactive, it writes a “0”.

I was using Vision, but decided to move to Perspective. The script I was using in Vision to write to the pins works like a charm, but I’m having troubles using it in Perspective and I’m assuming it’s because some of the commands I’m using for the Vision script don’t work in Perspective (could definitely be wrong about this…). With that being said, would anyone be able to point me in the right direction of some documentation that could potentially help with converting some of the commands to Perspective friendly, if that even is the issue?

The script in Perspective is below:

![GPIO Script](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/3471ea8c5f5be452e0208945d837c071b3bb567a.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 3, 2021, 7:56pm UTC](https://forum.inductiveautomation.com/t/write-to-gpio-pins-in-perspective/52690/2 "2021-11-03T19:56:36Z")

</div>

When you say a “Vision script” what do you mean by that exactly? You were executing the code in a button press?

When you write code in Perspective it’s going to be running on the gateway. Is the RPi hosting the gateway?

---

<div class="post-metadata">

**Author:** ![Brit](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@Brit](https://forum.inductiveautomation.com/u/Brit)\
**Post date:** [November 3, 2021, 8:10pm UTC](https://forum.inductiveautomation.com/t/write-to-gpio-pins-in-perspective/52690/3 "2021-11-03T20:10:21Z")

</div>

Yes, executing the script on a toggle button tied to a boolean tag. And yes, it is.
