How to Use WiringPi on Edge

What is WiringPi

WiringPi is a GPIO Controller basic on C Program. Originally a library for Raspberry Pie. Now we have migrated to Edge-V. You can control the 40 pin header by it. Of course, you can also directly control all GPIOs by modifying the code.

Begin to Use WiringPi

Control command

  • run gpio -h , you can see all the control command with WiringPi.
gpio: Usage: gpio -v
       gpio -h
       gpio [-g|-1] ...
       gpio [-d] ...
       [-x extension:params] [[ -x ...]] ...
       gpio [-p] <read/write/wb> ...
       gpio <mode/read/write/aread/awritewb/pwm/pwmTone/clock> ...
       gpio <toggle/blink> <pin>
       gpio readall
       gpio unexportall/exports
       gpio export/edge/unexport ...
       gpio wfi <pin> <mode>
       gpio drive <group> <value>
       gpio pwm-bal/pwm-ms 
       gpio pwmr <range> 
       gpio pwmc <divider> 
       gpio load spi/i2c
       gpio unload spi/i2c
       gpio i2cd/i2cdetect
       gpio rbx/rbd
       gpio wb <value>
       gpio usbp high/low
       gpio gbr <channel>
       gpio gbw <channel> <value>
GPIO  --> GPIO native number
wPi   --> WiringPi number
Mode  --> GPIO Mode ,`ALT` mean that this  pin defined as a special function
V     --> 1:HIGH 0:low 
PU/PD --> PU:pull up PD:pull down DSBLD:disabled PU/PD

Control by command

The code defaults to wPi mode control

Here’s an example of controlling wPi number 14.

  • run gpio mode 14 out
    Now, The wPi number 14 mode is out.
  • run gpio write 14 0 to change the pinout level
rk3399:/ # gpio mode 14 out
rk3399:/ # gpio write 14 0
rk3399:/ # gpio read 14
rk3399:/ # gpio write 14 1
rk3399:/ # gpio read 14

GPIO mode control

which controls all GPIOs directly by modifying the code as follows:

--- a/wiringPi/wiringPi.c
+++ b/wiringPi/wiringPi.c
@@ -793,7 +793,7 @@ int wiringPiSetup(void)
-        libwiring.mode = MODE_PINS;
+        libwiring.mode = MODE_GPIO;
         return 0;

Here’s an example of controlling gpio number 6,which control white LED lights on and off.

rk3399:/ # gpio mode 6 out
rk3399:/ # gpio write 6 0
rk3399:/ # gpio read 6
rk3399:/ # gpio write 6 1
rk3399:/ # gpio read 6


WiringPi itself includes many functions, not just controlling the output of GPIO pins and reading pin levels. Here is only a simple introduction and use, more use needs to be explored by users themselves.


not finding the gpio command in the khadas ubuntu OS

Hello, WiringPi is already installed.
Go to programs/System Tools and open UXTerm.
Once the terminal is open, type gpio-h, hit enter. This will show the commands available in WiringPi. For more information, see here.

@quatro My example above is Android.
@Frank Follow up

@quatro Which version frimware you used ? Some old version firmware was not supposted.