Bluetooth Workshop Example - 'BleUuid' does not name a type

So trying to follow the workshop at https://docs.particle.io/workshops/particle-101-workshop/ble/

But I seem to be getting caught at an error of the BleUuid type not being found.

Am I missing something simple here?

I am compiling this against an Argon with OS 1.5.1

BluetoothWorkshop.ino:13:7: error: 'BleUuid' does not name a type
 const BleUuid serviceUuid("5c1b9a0d-b5be-4a40-8f7a-66b36d0a5176"); // CHANGE ME

Here is the code I am using.

SYSTEM_THREAD(ENABLED);

#include "DiagnosticsHelperRK.h"

// Private battery and power service UUID
const BleUuid serviceUuid("5c1b9a0d-b5be-4a40-8f7a-66b36d0a5176"); // CHANGE ME

BleCharacteristic uptimeCharacteristic(
  "uptime", 
  BleCharacteristicProperty::NOTIFY, 
  BleUuid("fdcf4a3f-3fed-4ed2-84e6-04bbb9ae04d4"), 
  serviceUuid);

BleCharacteristic signalStrengthCharacteristic(
  "strength", 
  BleCharacteristicProperty::NOTIFY, 
  BleUuid("cc97c20c-5822-4800-ade5-1f661d2133ee"), 
  serviceUuid);

BleCharacteristic freeMemoryCharacteristic(
  "freeMemory", 
  BleCharacteristicProperty::NOTIFY, 
  BleUuid("d2b26bf3-9792-42fc-9e8a-41f6107df04c"), 
  serviceUuid);

void configureBLE() {
  BLE.addCharacteristic(uptimeCharacteristic);
  BLE.addCharacteristic(signalStrengthCharacteristic);
  BLE.addCharacteristic(freeMemoryCharacteristic);

  BleAdvertisingData advData;

  // Advertise our private service only
  advData.appendServiceUUID(serviceUuid);

  // Continuously advertise when not connected
  BLE.advertise(&advData);
}

void setup() {
  configureBLE();
}

void loop() {
  if (BLE.connected())
  {
    uint8_t uptime = (uint8_t)DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_UPTIME);
    uptimeCharacteristic.setValue(uptime);

    uint8_t signalStrength = (uint8_t)(DiagnosticsHelper::getValue(DIAG_ID_NETWORK_SIGNAL_STRENGTH) >> 8);
    signalStrengthCharacteristic.setValue(signalStrength);

    int32_t usedRAM = DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_USED_RAM);
    int32_t totalRAM = DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_TOTAL_RAM);
    int32_t freeMem = (totalRAM - usedRAM);
    freeMemoryCharacteristic.setValue(freeMem);
  }
}

What IDE are you using?

For me this compiles fine in Web IDE (after correcting the typo BleCharacteristicProperty::NOQTIFY)

Visual Studio Code. Hmmm. I just tried it in the web IDE as well and it worked.

If you use Workbench (aka VS Code) then I guess you haven’t actually set the target platform but only the target device.
Can you post a screenshot of the status bar of Workbench?

1 Like

Yep, you were right. I had only gone through the Workbench dashboard to “Configure for device”. I didn’t realize this also didn’t change the platform as well. I still had “photon” set in the status bar.

Once I changed it from “photon” to “argon” it compiled successfull.

I figured it was something simple. Thanks!

2 Likes