Write to GPIO Pins in Perspective

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

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?

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