{"id":21710246,"url":"https://github.com/rhthomas/adafruit_circuitpython_nrf24l01","last_synced_at":"2025-07-04T02:33:30.564Z","repository":{"id":81147445,"uuid":"174222688","full_name":"rhthomas/Adafruit_CircuitPython_NRF24L01","owner":"rhthomas","description":"nRF24L01+ CircuitPython library ported from Micropython.","archived":false,"fork":false,"pushed_at":"2019-07-18T09:53:22.000Z","size":1069,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T17:39:38.811Z","etag":null,"topics":["circuitpython","nrf24l01","radio","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhthomas.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-06T21:17:54.000Z","updated_at":"2025-03-21T16:31:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"6be0382a-816a-446e-b296-e72de75058f1","html_url":"https://github.com/rhthomas/Adafruit_CircuitPython_NRF24L01","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rhthomas/Adafruit_CircuitPython_NRF24L01","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2FAdafruit_CircuitPython_NRF24L01","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2FAdafruit_CircuitPython_NRF24L01/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2FAdafruit_CircuitPython_NRF24L01/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2FAdafruit_CircuitPython_NRF24L01/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhthomas","download_url":"https://codeload.github.com/rhthomas/Adafruit_CircuitPython_NRF24L01/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2FAdafruit_CircuitPython_NRF24L01/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263434161,"owners_count":23465909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circuitpython","nrf24l01","radio","raspberry-pi"],"created_at":"2024-11-25T23:14:19.397Z","updated_at":"2025-07-04T02:33:30.548Z","avatar_url":"https://github.com/rhthomas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Adafruit_CircuitPython_NRF24L01\n===============================\n\n.. image:: https://travis-ci.org/rhthomas/Adafruit_CircuitPython_NRF24L01.svg?branch=master\n    :target: https://travis-ci.org/rhthomas/Adafruit_CircuitPython_NRF24L01\n    :alt: Build Status\n\n.. image:: https://readthedocs.org/projects/circuitpython-nrf24l01/badge/?version=latest\n    :target: https://circuitpython-nrf24l01.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\nDependencies\n============\n\nThis driver depends on:\n\n* `Adafruit CircuitPython \u003chttps://github.com/adafruit/circuitpython\u003e`_\n* `Bus Device \u003chttps://github.com/adafruit/Adafruit_CircuitPython_BusDevice\u003e`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle \u003chttps://github.com/adafruit/Adafruit_CircuitPython_Bundle\u003e`_.\n\nUsage Example\n=============\n\nSee `examples/` for an example of how to use the library.\n\nTo run the example, open a python terminal in the example folder and run the following:\n\n.. code-block:: python\n    \n    \u003e\u003e\u003e from nrf24l01_simpletest import *\n\n        NRF24L01 test module.\n        Pinout:\n            CE on D5\n            CS on D6\n            SPI pins on SPI1\n\n        Run slave() on receiver, and master() on transmitter.\n\n    \u003e\u003e\u003e master()\n    Sending:  0\n    Sending:  1\n\nFirstly import the necessary packages for your application.\n\n.. code-block:: python\n\n    import time\n    import struct # transmitted packet must be a byte array\n    import board\n    import digitalio as dio\n    from busio import SPI\n    from adafruit_circuitpython_nrf24l01 import NRF24L01 # this library\n\nDefine the communication pipes (effectively device addresses/IDs) and the SPI connections to the radio.\n\n.. code-block:: python\n\n    pipes = (b'\\x01\\x02\\x03\\x04\\x00', b'\\x01\\x02\\x03\\x04\\x01') # tx, rx node ID's\n\n    ce = dio.DigitalInOut(board.D5)\n    ce.direction = dio.Direction.OUTPUT\n    cs = dio.DigitalInOut(board.D6)\n    cs.direction = dio.Direction.OUTPUT\n\n    spi = SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) # create instance of spi port\n    nrf = NRF24L01(spi, cs, ce, channel=0, payload_size=1) # create instance of the radio\n\nTo transmit firstly open the TX and RX pipes, stop listening (puts radio in transmit mode) and send your packet (`buf`).\n\n.. code-block:: python\n\n    def radio_tx():\n        nrf.open_tx_pipe(pipes[0])\n        nrf.open_rx_pipe(1, pipes[1])\n        nrf.stop_listening()\n\n        i = 0\n\n        while True:\n            try:\n                print(\"Sending: \", i)\n                nrf.send(struct.pack('i', i)) # be sure to pack data in byte array\n            except OSError:\n                pass\n            time.sleep(1) # send every 1s\n\nTo receive this data, again open the TX and RX pipes and start listening for data. The `nerf.any()` method returns true when there is data ready to be received.\n\n.. code-block:: python\n\n    def radio_rx():\n        nrf.open_tx_pipe(pipes[1])\n        nrf.open_rx_pipe(1, pipes[0])\n        nrf.start_listening()\n\n        while True:\n            if nrf.any():\n                while nrf.any():\n                    buf = nrf.recv()\n                    i = struct.unpack('i', buf) # byte array formats (`i`) must maadafruit_bus_device.spi_device.SPIDeviceadafruit_bus_device.spi_device.SPIDeviceadafruit_bus_device.spi_device.SPIDeviceadafruit_bus_device.spi_device.SPIDevicetch\n                    print(\"Received: \", i)\n                    time.sleep(0.5) # poll every 0.5s for new data\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n\u003chttps://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/blob/master/CODE_OF_CONDUCT.md\u003e`_\nbefore contributing to help this project stay welcoming.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhthomas%2Fadafruit_circuitpython_nrf24l01","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhthomas%2Fadafruit_circuitpython_nrf24l01","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhthomas%2Fadafruit_circuitpython_nrf24l01/lists"}