I have been trying to send an integer/char over BLE between the Arduino Nano 33 and a Nordic NRF52840. Currently, I can send a value through the manufacturing data but I feel that there must be a better way. I simply need to send certain values to be read by the Nordic so it doesn't matter if it is an integer or a string, whatever is best to send over BLE. Below is my current code that simply sends a determined value as the manufacture's data. Eventually, this value will be a variable that is updated when certain events happen, so please tell me if I will run into a problem by putting a variable into the data matrix instead of a constant value. Also, on the Nordic I am coding in C, which I have very little experience with.
#include <ArduinoBLE.h>
void setup()
{
BLE.begin();
}
void loop()
{
const int DATA_SIZE = 3;
uint8_t data[DATA_SIZE];
int x = 175;
data[0] = ( uint8_t ) x;
BLE.stopAdvertise();
BLE.setManufacturerData( data, DATA_SIZE );
BLE.advertise();
}