Due to high demand, expect some shipping delays at this time - orders may not ship for up to 2-3 business days.
0

Porting IDE sketch - BLE
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Porting IDE sketch - BLE

by carlohume on Mon Jan 24, 2022 1:12 pm

Below I have enclosed IDE sketch code that I am looking for same functionality in CircuitPython. I have not found an example that is similar. The other side is still in IDE sketch. I would like to be able to still communicate with the other microcomputer.

The other microcomputer is nano 33 ble. I'm using a Adafruit nRF52820

Thank you in advance for your help

The IDE sketch code defines the following:
Code: Select all | TOGGLE FULL SIZE
#define sensor_name "139.2"
#define sensorPresent_uuid  "2018"
#define sensorPresentChar_uuid   "2020"

BLEService sensorPresentService(sensorPresent_uuid);
BLEByteCharacteristic sensorPresentChar(sensorPresentChar_uuid, BLERead);
BLE.setLocalName(sensor_name);
BLE.setAdvertisingInterval(80);
sensorPresentService.addCharacteristic(sensorPresentChar);
BLE.addService(sensorPresentService);                         

...
BLE.setAdvertisedService(sensorPresentService);
BLE.advertise();

carlohume
 
Posts: 2
Joined: Sat Oct 23, 2021 8:24 am

Re: Porting IDE sketch - BLE

by danhalbert on Mon Jan 24, 2022 5:16 pm

Are you looking for how to act as a BLE peripheral and advertise services, in general?

See https://learn.adafruit.com/circuitpython-nrf52840/ for getting started, and also see the examples in
https://github.com/adafruit/Adafruit_Ci ... n/examples

danhalbert
 
Posts: 3179
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.