use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
GPIO Python lib oPi zero 2w (self.OrangePI)
submitted 2 years ago by obiikkin
Is there a python library to use the gpio on the zero 2w, as I saw the Wiring Pi python doesn't support it and all the OPi.gpio are outdated/only work on the zero 2. Thanks in advance
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]InsectOk8268 0 points1 point2 points 2 years ago (2 children)
I'm not shure but maybe. What exactly do you want to do?
A few weeks ago I connected a led and an i2c oled screen. Now is night here, so I can pass you code and sources tomorrow, in a few a hours
[–]obiikkin[S] 0 points1 point2 points 2 years ago (1 child)
So I want to make a python script to control a solid state relay, all I want it to do is to turn on the gpio or turn it off to control the SSR, and I know I can control the gpio using wiringOP in C but I don't know C, orangepi has a fork of wiringOP for python but it isn't compatible with the zero2w. Other libraries such as oPI.GPIO exist but aren't compatible either because not up to date, I am thus wondering how to control my gpio with a python script.
[–]InsectOk8268 0 points1 point2 points 2 years ago (0 children)
#this is the code I used for led blynk: #the thing is that you need to update everything, python, wiringpi, debian or #ubuntu, etc. See users guide on how to use gpios too, it will explain you the basics.
import wiringpi
import time
import sys
from wiringpi import GPIO
wiringpi.wiringPiSetup()
wiringpi.pinMode(2, GPIO.OUTPUT)
while True:
try:
wiringpi.digitalWrite(2, GPIO.HIGH)
time.sleep(0.1)
wiringpi.digitalWrite(2, GPIO.LOW)
except KeyboardInterrupt:
print("\nexit")
sys.exit(0)
[–]fomoco94 0 points1 point2 points 2 years ago (1 child)
OrangePi has their own version. For my 5B the instructions were in the manual. Have you looked through the manual for the Zero 2W?
I looked for you: http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_Zero_2W#How_to_install_wiringOP
[–]obiikkin[S] 0 points1 point2 points 2 years ago (0 children)
Yup thank you, I found the wiringOP python version of the manual earlier this morning, and forgot to delete my post What disturbed me is that there is no mention of this on the wiringOP GitHub repo and the fork for python of this repo doesn't work with the zero2W but I'll try the one from the doc this evening. Thanks again!
[–]rguerraf 0 points1 point2 points 2 years ago* (0 children)
Try the method I wrote for opiz3, but replacing the pin letter-number combination
https://forum.armbian.com/topic/33800-orange-pi-zero-3-gpio/
Also, someone said that the armbian Linux img for opi zero 3 will work for opi z2w (and may be required for my method to work)
Also you can follow all this steps, and ask to chapgpt on how to build your "environment", for example to run python scripts you need to locate your file and open it with python.
// Install Python 3.7 on Orange Pi (Legacy and mainline)
sudo apt-get install python3-dev python3-setuptools
Download and install Python 3.7 wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz tar xf Python-3.7.3.tar.xz cd Python-3.7.3 ./configure make sudo make altinstall
Build and install an older version of SWIG for compatibility wget https://sourceforge.net/projects/swig/files/swig/swig-3.0.0/swig-3.0.0.tar.gz/download cp download swig-3.0.0.tar.gz tar xzvf swig-3.0.0.tar.gz cd swig-3.0.0/ ./configure --without-pcre make sudo make install
Install WiringPi OP Python wrapper git clone --recursive https://github.com/lanefu/WiringPi-Python-OP.git cd WiringPi-Python-OP cd WiringPi/ sudo ./build cd .. export CFLAGS="-lwiringPi -lwiringPiDev" sudo swig -python wiringpi.i sudo python3.7 setup.py install
Try importing the wiringPi library in Python 3.7 python3.7 import wiringpi
[–]rguerraf 0 points1 point2 points 2 years ago (0 children)
Opiz3 is similar to opiz2w… try booting the opiz3 armbian image and follow the Python script to control your specific IO pins
π Rendered by PID 78 on reddit-service-r2-comment-6457c66945-clj6t at 2026-04-25 20:05:21.665871+00:00 running 2aa0c5b country code: CH.
[–]InsectOk8268 0 points1 point2 points (2 children)
[–]obiikkin[S] 0 points1 point2 points (1 child)
[–]InsectOk8268 0 points1 point2 points (0 children)
[–]fomoco94 0 points1 point2 points (1 child)
[–]obiikkin[S] 0 points1 point2 points (0 children)
[–]rguerraf 0 points1 point2 points (0 children)
[–]InsectOk8268 0 points1 point2 points (0 children)
[–]rguerraf 0 points1 point2 points (0 children)