wiringPi-Python/README.rst

64 lines
1.3 KiB
ReStructuredText
Raw Permalink Normal View History

2023-10-17 15:22:32 +08:00
Note
~~~~
2023-11-29 17:23:49 +08:00
wiringPi for Python
2023-10-17 15:22:32 +08:00
===================
2023-11-29 17:23:49 +08:00
wiringPi: An implementation of most of the Arduino Wiring functions for
the Banana Pi.
2023-10-17 15:22:32 +08:00
Supported boards
===================
tested on:
2023-11-29 17:23:49 +08:00
``Banana Pi M4 Berry``
``Banana Pi M4 Zero``
2023-10-17 15:22:32 +08:00
Manual Build
============
Get/setup repo
--------------
.. code:: bash
2023-11-29 17:23:49 +08:00
git clone --recursive https://github.com/BigQubot/wiringPi-Python.git
cd wiringPi-Python
2023-10-17 15:22:32 +08:00
Don't forget the --recursive; it is required to also pull in the WiringPi C code from its own repository.
Prerequisites
-------------
To rebuild the bindings you **must** first have installed ``swig``,
2023-11-29 17:23:49 +08:00
``python3-dev``, and ``python3-setuptools``. wiringPi should also be installed system-wide for access
2023-10-17 15:22:32 +08:00
to the ``gpio`` tool.
.. code:: bash
sudo apt-get install swig python3-dev python3-setuptools
Build & install with
--------------------
``python3 generate-bindings.py > bindings.i``
``sudo python3 setup.py install``
Usage
=====
.. code:: python
import wiringpi
# One of the following MUST be called before using IO functions:
wiringpi.wiringPiSetup() # For sequential pin numbering
**General IO:**
.. code:: python
wiringpi.pinMode(6, 1) # Set pin 6 to 1 ( OUTPUT )
wiringpi.digitalWrite(6, 1) # Write 1 ( HIGH ) to pin 6
wiringpi.digitalRead(6) # Read pin 6