Hi there,
Code compiles fine, It’s definitely not following the BLE connection setup standards,
It advertises an Empty service?
I’m using Nrf connect both on Android phone Sammy S9+ and the Windows PC with a Nrf52 USB Dongle. (a must have for any serious BLE type dev effort , it’s $10.btw) Here is what I see
and this is the serial port;
Mic initialization done.
BLE Peripheral is now advertising
If you connect to it,
its an unknown service that is empty?
you need to finish the sketch by adding the proper write value and Service UUID’s that make sense,
you made yours up?
Here is what a REAL set looks like:
String statusString;
//Create a instance of class BLE services & characteristics
BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // Bluetooth® Low Energy LED Service
// Bluetooth® Low Energy LED Switch Characteristic - custom 128-bit UUID, read and writable by central
BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
BLEService fallService("19B10002-E8F2-537E-4F6C-D104768A1214");
BLEStringCharacteristic fallCharacteristic("19B10003-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 20);//4E-6F-20-46-61-6C-6C"No Fall"(READ), Notify ON, 46414c4c "FALL"
BLEFloatCharacteristic impactLevelCharacteristic("19B10004-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
BLEBoolCharacteristic enableFallDetectionCharacteristic("19B10008-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
// BLE Service and Characteristics
BLEService motionService("19B10005-E8F2-537E-4F6C-D104768A1214");
BLEStringCharacteristic motionCharacteristic("19B10006-E8F2-537E-4F6C-D104768A1214", BLERead | BLENotify, 20);//4E-6F-20-4D-6F-74-69-6F-6E"No Motion", (READ), Notify ON, 4d4f54494f4e "MOTION"
BLEFloatCharacteristic motionSensitivityCharacteristic("19B10007-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
BLEBoolCharacteristic enableMotionDetectionCharacteristic("19B10009-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
BLEService systemStatusService("19B1000C-E8F2-537E-4F6C-D104768A1214"); // UUID for the service
BLEStringCharacteristic systemStatusCharacteristic("19B1000B-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite, 200 ); // UUID for the characteristic
the numbers need to make sense to not take up too much dimension. Look at some of the streaming IMU data over BLE examples. closer to what you want. But your on the right path.
I wouldn’t write everything to the serial monitor either.just the connection and status information. you need all the time for the BLE peripheral data.
you can’t just BLAST the Data out you need some buffering… to stream it consistently to the BLE client
either low latency or or high through put, you can adjust the methods , use DMA or a FIFO.
HTH
GL PJ
here is the Nrf connect for desktop with the BLE dongle connected. Red arrow is pointing to empty service with no Data? You need to fix that either with a string or the hex or something.
You have a good start look at those other examples and you’ll find one similar forsure.
search here for "IMU’ BLE data type keywords.
HTH
GL
PJ