On-line tutorials, general Python with Rpi.gpio to control the Raspberry Pi Gpio, and C + + generally use WRINGPI library to operate Gpio,rpi.gpio too simple, many advanced features do not support, such as I2C/SPI library, etc., but also lack of high-precision timing and other advanced features. In contrast, WIRINGPI is rich in functionality, but in fact WRINGPI already has Python bindings that can be very simple to use in Python. Since there is basically no Chinese description of this library on the Internet, I am learning to write a few articles about the basic use of this library while taking notes.
Installation: Install PYTHON-PIP First:
I use the Archlinux,python3, the installation command is:
Pacman-s Python-pip
If you use Python2, the installation command is:
Pacman-s Python2-pip
The following Raspbian are:
Install python3-pipaptInstall Python-pip
Once the installation is complete, you can install the Python library with Pip install. To avoid the tedious, my commands are installed under the PIP command, archlinux the default is Python3 PIP3, if you use a python2 pip2 instead of Pip,debian under the default PIP2 pip, if you use Python3, Use the PIP3 instead.
Install Wiringpi2
PIP Library In addition to WIRINGPI2, there is an old version of the WIRINGPI library, you install on demand.
After installation, run the PIP list and you can see the list contains the newly installed WRINGPI2 library:
In the terminal, enter Python, go to the Python console, import, if not error, the installation is successful:
Raspberry Pi Advanced Gpio Library, WRINGPI2 for Python use note (i) Install