BananaPro/Pi:GPIO library

From BananaPro/Pi
Jump to: navigation, search



General Purpose Input Output (General Input/Output) as the GPIO, or bus expander, use I2C, SMBus or industrial standard SPI interface simplifies the I/O port extension.When the micro controller or chipset do not have enough I/O ports, or when the system needs to use the remote serial communication or control, GPIO products can provide additional control and monitoring functions. The modified RPi.GPIO library for Banana Pro/Pi can be download from LeMaker github.


For Banana Pro:

git clone -b bananapro

For Banana Pi:

git clone -b bananapi


You need have the python-dev package:

sudo apt-get update
sudo apt-get install python-dev

Compile and install:

python install                 
sudo python install

Attention: you need install twice like above, first not using sudo. After that, you can use the RPi.GPIO python script.



Wiring Pi is a GPIO library written by Drogon. It is originally for the Raspberry Pi, but LeMaker has modified and adapted it to make it work on the Banana Pro/Pi, we call it WiringBP. More example details can be found at All these examples can be used directly on the Banana Pro/Pi.

How to use WiringPi on the Banana Pro/Pi

Download the WiringBP on your Banana Pro/Pi.
For Banana Pro:

git clone -b bananapro

For Banana Pi:

git clone -b bananapi

After download, you need direct into the WiringBP directory and run:

cd WiringBP/
sudo chmod +x ./build

And then install the WiringBP:

sudo ./build

Check the Pin definitions in WiringPi

Please use the gpio command in the command line to see the pin definitions:

gpio readall

You will then see this information:

Wiringpi pins.jpg

The simplest program: Blink

Blink is the simplest program to control the I/O pins on the board. Create a file called blink.c with the content:

#include <wiringPi.h>
int main (void)
  wiringPiSetup () ;
  pinMode (0, OUTPUT) ;
  for (;;)
    digitalWrite (0, HIGH) ; delay (500) ;
    digitalWrite (0,  LOW) ; delay (500) ;
  return 0 ;

Then to compile and run, you would enter below in the command line:

gcc -Wall -o blink blink.c -lwiringPi
sudo ./blink

To see the output of this, you would need to connect a single LED between CON3-11 and GND with a resistor protecting it. It looks like this:
Wiringpi blink.jpg

The red LED will blink.

More Tests

HWL_Stouf did some very thorough and rigorous tests on the Banana Pi using WiringPi. Here is the link



The modified BCM2835 gpio C library for Banana Pro can be download from LeMaker github.


For Banana Pro:

git clone


sudo make check
sudo make install

After that, you can use the BCM2835 library to operate the gpio