Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

This library provides simple byte and string based inter-device communication via BLE.

It works like a walkie-talkie: configure your device to use a certain channel (numbered 0-255, default being 42) and it will broadcast on that channel and receive any messages from other devices using that channel.

Dependencies

This library depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Usage Example

All the functionality is exposed via the very simple Radio class:

from adafruit_ble_radio import Radio


# A radio instance listens/broadcasts on a numbered channel.
r = Radio(channel=7)

# Update radio instance settings.
r.configure(channel=9)

# Broadcast a simple string message.
r.send("Hello")

# Broadcast raw bytes.
r.send_bytes(b"Hello")

# A loop to listen for incoming string based messages...
while True:
    msg = r.receive()
    if msg:
        print(msg)

# Alternatively, to get the raw bytes and other details...
while True:
    msg = r.receive_full()
    if msg:
        msg_bytes = msg[0]
        msg_strength = msg[1]
        msg_time = msg[2]
        print("Recieved {} (strength {}, at time {})".format(
              msg_bytes,
              msg_strength,
              msg_time))

Unit Tests

To run the test suite you should have pytest and pytest-coverage installed (pip install pytest pytest-coverage).

Run the unit tests with the following command:

$ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Release files for adafruit-circuitpython-ble-radio 0.5.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-ble-radio 0.5.17
File Size Uploaded
adafruit_circuitpython_ble_radio-0.5.17.tar.gz 26.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-ble-radio 0.5.17
File Interpreter ABI Platform
adafruit_circuitpython_ble_radio-0.5.17-py3-none-any.whl Python 3 none any Details

Total release size: 33.5 kB

Release files / adafruit_circuitpython_ble_radio-0.5.17.tar.gz

Download URL adafruit_circuitpython_ble_radio-0.5.17.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
219864579fc38ef21dff51488309ccdf0db7875e2b5fac6795c2c0ce18b4c080
BLAKE2b-256 checksum
How to use checksums
d79a0f00b717d950272bb45425e256a2516aca3a5b88e4f8ec9e6e7614565fb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_ble_radio-0.5.17-py3-none-any.whl

Download URL adafruit_circuitpython_ble_radio-0.5.17-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3cc207330c9273e8abb0ed09a6a95a887ce6d3b62a393e29e6e21ffcd21b50b
BLAKE2b-256 checksum
How to use checksums
0d2bb56717ee926eb7cd5254466724ee4f7e6d33d85487af305721dfb3f3f831
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.5.17 This release

2 release files

0.5.16

2 release files

0.5.15

2 release files

0.5.14

2 release files

0.5.13

2 release files

0.5.12

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page