ArduinoBLE - BLE.setAdvertisedService()

Set the advertised service UUID used when advertising to the value of the BLEService provided.

Syntax

BLE.setAdvertisedService(bleService)

Parameters

  • bleService: BLEService to use UUID from

Returns

Nothing

Example


BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // Bluetooth® Low Energy LED Service

// ...

  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting Bluetooth® Low Energy module failed!");

    while (1);
  }

  BLE.setAdvertisedService(ledService);

  // ...  

  // start advertising
  BLE.advertise();