I am trying to use my Metro m4 AirLift Lite microcontroller as a BLE server. My goal is to connect to a GoPro camera via a BLE connection and synchronize the camera clock with the clock on my GPS shield. I am using the following code to test the BLE functionality of my microcontroller.
Code: Select all
# coding: utf8
#ble_search_gopro.py
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# This example scans for any BLE advertisements and prints one advertisement and one scan response
# from every device found. This scan is more detailed than the simple test because it includes
# specialty advertising types.
from adafruit_ble import BLERadio
from adafruit_ble.advertising import Advertisement
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_airlift.esp32 import ESP32
esp32 = ESP32()
adapter = esp32.start_bluetooth()
ble = BLERadio(adapter)
uart_server = UARTService()
advertisement = ProvideServicesAdvertisement(uart_server)
print("scanning")
found = set()
scan_responses = set()
# By providing Advertisement as well we include everything, not just specific advertisements.
# Advertisement
for advertisement in ble.start_scan(ProvideServicesAdvertisement):
addr = advertisement.address
if advertisement.scan_response and addr not in scan_responses:
scan_responses.add(addr)
elif not advertisement.scan_response and addr not in found:
found.add(addr)
else:
continue
print(addr, advertisement)
print("\t" + repr(advertisement))
print()
print("scan done")
Code: Select all
scanning
Traceback (appels les plus récents en dernier) :
Fichier "code.py", ligne 31, dans <module>
Fichier "adafruit_ble/__init__.py", ligne 250, dans start_scan
NotImplementedError:
Obviously, CircuitPython results in a non-implemented method. But which? First question: Can the microcontroller and its library allow to implement a BLE server? If so, what is wrong with my code?
Thank you.