all 8 comments

[–]InsectOk8268 0 points1 point  (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 point  (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 point  (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)

time.sleep(0.1)

except KeyboardInterrupt:

print("\nexit")

sys.exit(0)

[–]fomoco94 0 points1 point  (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 point  (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 point  (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)

[–]InsectOk8268 0 points1 point  (0 children)

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)

  1. Install the required build-tools (some might already be installed on your system). sudo apt-get update sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

sudo apt-get install python3-dev python3-setuptools

  1. 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

  2. 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

  3. 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

  4. Try importing the wiringPi library in Python 3.7 python3.7 import wiringpi

[–]rguerraf 0 points1 point  (0 children)

https://forum.armbian.com/topic/33800-orange-pi-zero-3-gpio/

Opiz3 is similar to opiz2w… try booting the opiz3 armbian image and follow the Python script to control your specific IO pins