Can't compile BLE, 'does not name a type'

Hello. I have been unable to get Bluetooth examples to compile (targeting Boron). I can’t tell if there is a library that should be installed.

I have tried several of the examples in the tutorials and an example “bluetooth-central-thingy52.ino” posted by jaredwolff.

All of the Ble items are red underline like BleUuid. Lots of errors like ‘BleScanResult’ does not name a type

I am trying to create a simple handler where I can attempt to write to and read from a handle and capture the result into a variable. This has proven to be a lot more challenging than I would have expected.

Thanks for any help. Cheers!

It would be helpful to post a link to the examples/libraries so folks can comment and not have to spend time searching for

I tried these two examples:
https://docs.particle.io/tutorials/device-os/bluetooth-le/#body-temperature-thermometer
https://docs.particle.io/tutorials/device-os/bluetooth-le/#heart-rate-central

All of the lines beginning with Ble are red underlined, as if it can’t find a library. I downloaded the IDE from the link on the particle site. It does compile fine for other things - I am successfully talking to the particle cloud via cellular.

Thank you.

Using this in the web IDE - i commented out all references to the old display and it copied fine.

Copied same source into workbench and it complied for xenon (1.4.4) just fine.

> Executing task: make -f '/Users/shanevanj/.particle/toolchains/buildscripts/1.8.0/Makefile' compile-user -s <


:::: COMPILING APPLICATION

Creating /Users/shanevanj/Documents/Workbench/Test/BLEtest/target/1.4.4/xenon/platform_user_ram.ld ...
Creating /Users/shanevanj/Documents/Workbench/Test/BLEtest/target/1.4.4/xenon/platform_user_ram.ld ...
   text    data     bss     dec     hex filename
  17948     116    3680   21744    54f0 /Users/shanevanj/Documents/Workbench/Test/BLEtest/target/1.4.4/xenon/BLEtest.elf

*** COMPILED SUCCESSFULLY ***


Press any key to close the terminal.

What device are you targeting ? are you using Workbench?

1 Like

Thank you Shane.

I am using Visual Studio Code downloaded from the link on the Particle site. That’s what the startup instructions said to use. I really need to use the IDE I’ve already invested time in as a fairly elaborate application has already been written and is presently working. I haven’t used the web interface at all.

I just need to read a Bluetooth sensor which I thought was supposed to be very easy to do, but it’s been days of time studying Bluetooth and the Particle docs and I’m still nowhere, can’t even get Particle to compile.

All I want to do is query a moisture value and that’s seeming to be very difficult to do. I’m afraid I’m going to have to give up on using Paticle for this. I have a lot of experience with PIC processors in other IDEs like MPLAB X. I just haven’t been able to follow any instructions that work.

I have attached a screenshot. Again I’m obviously very new to this IDE. It looks like a mess of red lines. I just followed the “create new project” link in the Particle Studio screen and pasted the code from the Particle Tutorial page.

Thank you.

If you can post a screenshot of the entire VSC window (including the status bar at the bottom) we may be ablie to confirm or refute the suspision @shanevanj was trying to hint with this comment

BTW, have you actually tried to compile or did you purely rely on the IntelliSense squiggles?

I’m sorry I can’t post the entire thing. The paths include information I can’t publish.

I am compiling. I am getting many of the following errors:

error: 'BleScanResult' does not name a type

It does this for everything beginning with Ble. Like it’s missing a library. Though I am able to compile other projects that use cellular cloud and SPI libraries in the same IDE. I found a command prompt to add libraries, but you need to know the name of the library first.

I created this current project blank just to see if I can query BLE. I clicked the little spark symbol on the left of the Visual Studio window. This brings up a screen that says “Particle” at the top. In one of the boxes below “Code” is “Create new project”. I created the new project and I pasted the code exactly as it is written on the Bluetooth tutorials page.

I don’t know if it is targeting a Boron or not. No idea where I would check or set this. I do have a Boron plugged in via USB that is in cyan breathing mode. I have been able to compile and upload my other SPI/Cellular application (minus the Ble stuff) using this configuration.

I don’t know if it’s using “Workbench” or not. I’m totally new to Particle and so far it has been a lot harder than I would have thought. I downloaded the IDE from the link on the Particle Site. It is Visual Studio Code. I’ve never used Visual Studio. I do work regularly in MPLABX for PIC and Atmel Studio for ATMEGA and I’ve been programming microprocessors for years and so far I’m lost with this IDE.

I still haven’t totally figured out how to link secondary pages of code because it doesn’t seem to like the .c and .h file types, there are both .ino and .cpp files, etc. It just seems complicated and seems to require a lot of tribal knowledge to get started. Maybe it’s the c++ aspect as I normally work in pure C. I have to use a Particle module for this project due to cellular. I really wanted to love Particle and have been looking forward to using it, but so far I’m not a fan (though the cellular setup and pairing was super easy with the app).

Thank you again for the help.

Then at least post the status bar at the bottom of the VSC window.
There is no library required as BLE is part of the device OS, but if you are targeting the wrong platform or an older version of the device OS you'd see that error.
This is what we would be looking at when we were able to see the status bar.

Here is the failure message.

I just figured it out. My other window for the working application shows “boron” on the bottom but this new project showed “photon” at the bottom. I didn’t realize “photon” was another device. I don’t think I was prompted to select a device during creating the new project.

I thought “Photon” was Particle’s brand name for their OS and cloud/mesh system. I thought that “photon” was telling me what version of the photon OS was on the device.

The BLE example does compile now. We’ll see if I’m able to query sensor data now. Fingers crossed.

ble3

2 Likes