Orange Pi (Armbian): install the WiringOP library (WiringPi equivalent)

orange pi wiringpi wiringop gpio library
Table of Contents

The WiringPi library that allows you to use the Raspberry PI expansion slot (GPIO) has been adapted to Orange Pi. The source code of the library is available on GitHub at this address The version for Orange Pi takes the name WiringOP. Many examples are available in the examples directory and show how to use it with some common expansion boards: PiFace, PiGlow, GertBoard … All you have to do is test it!

Equipment used

For this tutorial, I used an Orange Pi Lite (Wi-Fi version) but the method should apply to all the range (to check for Orange Pi Zero which has a 26-pin connector instead of 40). I installed the Armbian distribution (Desktop version).

Installing the WiringOP library

Log on to the user account where you want to install the library, go to the / home directory for example, and then start recovering sources from GitHub.

git clone -b h3 && cd WiringOP

Then we enter the file, and we start the compilation after giving the appropriate rights.

cd WiringOP
chmod +x ./build
sudo ./build

Knowing the state of the GPIO (and the correspondence with the Raspberry GPIO)

Run the gpio readall command. In return, you will get the status of each pin. For example in column V, a 1 means that the output is active, not let’s see right after. In the table, there is also the correspondence of each pin with the Raspberry GPIO.

orange pi wiringpi wiringop gpio library

Enable, disable an output

Connect a Led to pin 29 (PG7) through a 220惟 resistor, then close the circuit by returning to a GND pin (0V in the table above).

Let’s start by changing the output mode of pin 29.

gpio mode 29 out

Now, if you want to turn on the led

gpio write 29 on

Now look at the status of the pins by making a gpio readall.

orange pi wiringpi wiringop gpio librarie write 29 on

In column V of output 29, the spindle is in state 1.

To turn it off, you switch off

gpio write 29 off

Using the WiringOP library in a script

Open a new script named for example then paste the code below. Save it with CTRL+X then Y

gpio mode 29 out  
while true; do  
    gpio write 29 on
    sleep 5
    gpio write 29 off
    sleep 1

This script flashes the LED (one pulse per second) until the script is stopped at the keyboard (CTRL+X).

Make the script executable

chmod +x

And run the


Here you can now use the Orange Pi GPIO in your scripts.

Click to rate this post!
[Total: 0 Average: 0]

Thanks聽for your reading

Did you like this project ? Don't miss any more projects by subscribing to our weekly newsletter!

Are you having a problem with this topic?

Maybe someone has already found the solution, visit the forum before asking your question
  1. Any version of this for the Orange Pi Zero? It seems this doesn’t map exactly to that one (not counting the shorter expansion port ofc). Using Armbian (Ubuntu server) for the Zero. I installed this library and tried some (not all) pins just to check. Some worked some didn,t, so I figured I’d better not set pins that don’t really work on the GPIO’s they’re supposed to. I almost don’t know what I’m doing btw 馃檪 But eventually I’d like to make a C++ program and control the GPIO’s for a project. I’ve only meddled a bit with Arduino a few years ago.

Leave a Reply

Read more
DIY Projects
DIY Projects
%d bloggers like this: