# BPI-M2 WiringPi

**install BPI-M2 WiringPi:**

1，Download WiringPi from github For BPI-M2

`git clone https://github.com/BPI-SINOVOIP/BPI-WiringPi.git -b BPI_M2`

2，Installation：

`cd BPI-WiringPi`

`chmod +x ./build`

`sudo ./build`

3，test wiringPi is install success

`gpio -v`

![](https://1265032173-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M2HWtRAeSna97-WL0mR%2F-M2HWvGmXE4MI8VrC8lC%2F-M2HXLE9kduJbZURM-di%2FBPI-M2%20wiringpi%201.png?generation=1584080207047656\&alt=media)

`gpio readall`

![](https://1265032173-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M2HWtRAeSna97-WL0mR%2F-M2HWvGmXE4MI8VrC8lC%2F-M2HXLEB7ePDy6lmVdO6%2FBPI-M2%20wiringpi%202.jpg?generation=1584080207051580\&alt=media)

4，create new : blink.c

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

compile and run it:

`gcc -Wall -o blink blink.c -lwiringPi`

runing it:

`sudo ./blink`

BPI have many extend board support WiringPi. so you can free DIY by youself:

more about BPI extend board,please see:

<https://bananapi.gitbooks.io/bpi-accessories/content/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bananapi.gitbook.io/bpi-m2/zh/bpi-m2_wiringpi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
