Sending float over BLE

The issue is your characteristic definition. Change it to

BLEByteCharacteristic pressureBLE ("2A19", BLERead | BLENotify );

When you create a generic BLECharacteristic the last parameter is the valueSize not a buffer size. You have to write the correct amount of bytes to update the characteristic. For your case it seems better to use a characteristic of the correct type.

Here are a few other things I noted about your code:

  • the UUID for the characteristic is 16-bit, you should use a 128-bit random UUID
  • the UUID for the service is not random, you can use a few bits to group a few UUIDs but most bits should be random
  • you use while in loop and delay(), while this is keeps simple examples short it will prevent you from extending your sketch later without breaking what you already have. Try to ensure your loop() function is running as often as possible.

Have a look at the following example to learn to time control parts of your code

File -> Examples -> 02.Digital -> BlinkWithoutDelay

  • your variable naming could be improved avoid short variable names if they become cryptic or could mean different things e.g. you called a pin for a LED "red" and then you had to rename the function parameters to "readL" to avoid a naming collision. You could have use redLedPin for instance.
  • the following code is wrong (the compiler fixes the code in the background)
float sensor = A0; // wrong data type for  pin
... analogRead(sensor) ...

I have written a little example that includes a few other techniques that might be useful.

BLE Sensor example (click to view)
/*
  This example creates a BLE peripheral with a service and a characteristic.

  The circuit:
  - Arduino Nano 33 IoT.

  You can use a generic BLE central app, like LightBlue (iOS and Android) or
  nRF Connect (Android), to interact with the services and characteristics
  created in this sketch.

  This example code is in the public domain.
*/

#include <ArduinoBLE.h>

//----------------------------------------------------------------------------------------------------------------------
// BLE UUIDs
//----------------------------------------------------------------------------------------------------------------------

#define BLE_UUID_SENSOR_SERVICE          "82D20000-87F8-C79D-9E63-A091F4171879"
#define BLE_UUID_PRESSURE                "82D20001-87F8-C79D-9E63-A091F4171879"

//----------------------------------------------------------------------------------------------------------------------
// BLE
//----------------------------------------------------------------------------------------------------------------------

#define BLE_DEVICE_NAME                 "Arduino Nano 33 IoT"
#define BLE_LOCAL_NAME                  "Arduino Nano 33 IoT"

BLEService sensorService( BLE_UUID_SENSOR_SERVICE );
BLEShortCharacteristic pressureCharacteristic( BLE_UUID_PRESSURE, BLERead | BLENotify );

//----------------------------------------------------------------------------------------------------------------------
// I/O and App
//----------------------------------------------------------------------------------------------------------------------

#define BLE_LED_PIN                     LED_BUILTIN
#define PRESSURE_SENSOR_PIN             A0

uint16_t averagePressure = 0;
bool updatePressureCharacteristic = false;

void setup()
{
  Serial.begin( 9600 );
  while ( !Serial );

  pinMode( BLE_LED_PIN, OUTPUT );
  pinMode( PRESSURE_SENSOR_PIN, INPUT );
  analogReadResolution( 10 );

  if ( !setupBleMode() )
  {
    Serial.println( "Failed to initialize BLE!" );
    while ( 1 );
  }
  else
  {
    Serial.println( "BLE initialized. Waiting for clients to connect." );
  }
}

void loop()
{
  bleTask();
  sensorTask();
}


void sensorTask()
{
  #define SENSOR_SAMPLING_INTERVAL  50
  #define SAMPLE_BUFFER_SIZE        10

  static uint16_t sampleBuffer[SAMPLE_BUFFER_SIZE] = { 0 };
  static uint32_t previousMillis = 0;
  static uint32_t sampleIndex = 0;

  uint32_t currentMillis = millis();
  if ( currentMillis - previousMillis >= SENSOR_SAMPLING_INTERVAL )
  {
    previousMillis = currentMillis;
    uint16_t currentPressure = analogRead( PRESSURE_SENSOR_PIN );
    sampleBuffer[sampleIndex] = currentPressure;
    sampleIndex = ( sampleIndex + 1 ) % SAMPLE_BUFFER_SIZE;

    if ( sampleIndex == 0 )
    {
      uint32_t bufferTotal = 0;
      for ( uint32_t i = 0; i < SAMPLE_BUFFER_SIZE; i++ )
      {
        bufferTotal += sampleBuffer[i];
      }
      averagePressure = (uint16_t) round( bufferTotal / SAMPLE_BUFFER_SIZE );
      updatePressureCharacteristic = true;
    }
  }
}


bool setupBleMode()
{
  if ( !BLE.begin() )
  {
    return false;
  }

  // set advertised local name and service UUID
  BLE.setDeviceName( BLE_DEVICE_NAME );
  BLE.setLocalName( BLE_LOCAL_NAME );
  BLE.setAdvertisedService( sensorService );

  // add characteristics
  sensorService.addCharacteristic( pressureCharacteristic );

  // add service
  BLE.addService( sensorService );

  // set the initial value for the characeristics
  pressureCharacteristic.writeValue( averagePressure );

  // set BLE event handlers
  BLE.setEventHandler( BLEConnected, blePeripheralConnectHandler );
  BLE.setEventHandler( BLEDisconnected, blePeripheralDisconnectHandler );

  // start advertising
  BLE.advertise();

  return true;
}


void bleTask()
{
  #define BLE_UPDATE_INTERVAL 10
  static uint32_t previousMillis = 0;

  uint32_t currentMillis = millis();
  if ( currentMillis - previousMillis >= BLE_UPDATE_INTERVAL )
  {
    previousMillis = currentMillis;
    BLE.poll();
  }

  if ( updatePressureCharacteristic )
  {
    updatePressureCharacteristic = false;
    pressureCharacteristic.writeValue( averagePressure );
  }
}


void blePeripheralConnectHandler( BLEDevice central )
{
  digitalWrite( BLE_LED_PIN, HIGH );
  Serial.print( "Connected to central: " );
  Serial.println( central.address() );
}


void blePeripheralDisconnectHandler( BLEDevice central )
{
  digitalWrite( BLE_LED_PIN, LOW );
  Serial.print( "Disconnected from central: " );
  Serial.println( central.address() );
}