Optimized high speed nRF24L01+ driver class documentation v1.4.10
TMRh20 2020 - Optimized fork of the nRF24L01+ driver
|
We recommend using the newer pyRF24 package available from pypi because
help()
The only reason that you should need to keep using these older individual python wrappers is if you must use python v3.6 or older.
You cannot use these individual wrappers in combination with the pyRF24 package.
These instructions work for the RF24, RF24Network, and RF24Mesh libraries, but the C++ source code needs to be built and installed for the corresponding python wrapper(s) to work.
venv
(which is a minimized variant of the virtualenv
library). sudo
within a python virtual environment.Next, install some up-to-date python packages.
Install the library.
This step needs to be executed from the appropriate directory of the cloned RF24* repository:
When in the correct directory, run the following command:
-v
option enables pip's verbose output to show that the process has not frozen.See the additional Platform Support pages for information on connecting your hardware.
See the included *.py files in the "examples_linux" folder for usage information.
Running the Example
The python examples location differ for each RF24* repositories.
Navigate to the examples_linux directory
Edit the getting_started.py example to configure the appropriate pins per the Linux/RPi General documentation.
Configure another device, Arduino or RPi with the same example code. It could be C++ or python (see the list of available examples), but we'll use the same example file on a different device in this tutorial.
Run the example
or for python3
Running the python wrappers built with 'pigpio' or 'RPi' drivers requires sudo
permission.
If you are working in a python virtual environment (aka "venv"), then the virtual environment's python executable must be specified after sudo
. Otherwise, sudo
may invoke the system-installed python executable which can lead to errors.
Assuming the python virtual environment is located in ~/venv
, use the following command:
This sudo
advice must be observed even while the virtual environment is activated.
See more information about python virtual environments in the python documentation.