Porting IDE sketch - BLE

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
carlohume
 
Posts: 2
Joined: Sat Oct 23, 2021 8:24 am

Porting IDE sketch - BLE

Post by carlohume »

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

#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();

User avatar
danhalbert
 
Posts: 4652
Joined: Tue Aug 08, 2017 12:37 pm

Re: Porting IDE sketch - BLE

Post by danhalbert »

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

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”