CircuitPython's AirLift support only provides BLE peripheral support. This means you can not use CircuitPython BLE code to BLE devices such as thermometers to the RP2040.

We have written lots of examples and projects for using CircuitPython's BLE peripheral mode. However, these examples are designed to work with CircuitPython hardware that includes a built-in BLE module such as the Nordic NRF52840.

Adapting code that uses the built-in BLE module to use the AirLift ESP32's BLE mode is simple. Add the following line to your code to import the adafruit_airlift module:

from adafruit_airlift.esp32 import ESP32

Code that utilizes native adafruit_ble will have the following line which initializes an onboard BLE module: 

ble = BLERadio()

Replace this line with the following lines below to initialize the AirLift and set up the BLERadio module for use with the AirLift. Make sure to match the esp32's pinout with your wiring.

esp32 = ESP32(

adapter = esp32.start_bluetooth()
ble = BLERadio(adapter)

That's it - you do not need to modify the rest of the code, it should work as-is! Visit the Adafruit Learning System for more guides on using Bluetooth Low Energy with CircuitPython.

This guide was first published on Mar 26, 2021. It was last updated on Jun 17, 2024.

This page (Adapting Existing CircuitPython BLE Code for AirLift BLE) was last updated on Mar 08, 2024.

Text editor powered by tinymce.