WiringPi Library on NanoPi M1

This post is writen by Nicolas.

Searching in the web and with the help of Yudanta’s Blog, I found a WiringPi library for the OrangePi PC board, which it is not the same as NanoPi M1 board, but, it has the same processor! the famous AllWinner H3 CPU, and given that the GPIO are pins directly connected to the CPU, it was likely that might work.

I downloaded the library from https:\/\/github.com\/zhaolei\/WiringOP and installed it with this steps:

git clone https://github.com/zhaolei/WiringOP.git -b h3
cd WiringOP
sudo ./build

Then, you can test it executing this command:

gpio readall

And you should get something like this:

Then, to play a little more I connected a LED (with a 10k resistor) to the board in this way:

~~~~

connecting the anode to the physical PIN 37 (I explain later why this PIN) and the cathode throw the resistor to ground (PIN 6).

Then, with gpio commands I could turn the LED ON and OFF:

  1. Set the gpio port mode to out:

    gpio mode 23 out

  2. Turn ON the led:

    gpio write 23 on

  3. Turn OFF the led

    gpio write 23 off

And then we can use the Yudanta’s example of bash script to blink the LED ON and OFF :

#!/bin/bash

gpio mode 23 out  
while true; do  
    gpio write 23 on
    sleep 1
    gpio write 23 off
    sleep 1
done

The GPIO mapping is not easy, but based on the Pete’s article, the GPIO PIN 23 is the mapped as GPIOA9, and if we look at the NanoPi M1 documentation, we can see that the GPIOA9 is the physical PIN number 37:

After that, we have the NanoPi M1 GPIO working with the WirinPi Library!

results matching ""

    No results matching ""