When trying to use Redbear BLE nano Blynk example, recieving fatal error: BLE_API.h no such file or directory

As RFduino wasn’t connecting and I wanted to use Blynk with a BLE device I purchased a Red Bear Labs BLE Nano kit since I see it supported in the drop down list of boards in Blynk. I have previously installed the arduino libraries for Blynk (I was able to successfully compile Blynk code for Rfduino in the past) as well as installed the BLE Nano kit board in Arduino.

I have opened the example file included with the blynk libraries (RedBearBab_BLE_Nanotest) and I have tried to compile it. I get the following error:

In file included from C:\Users\sugar\OneDrive\Documents\Arduino\RedBearLab_BLE_Nanotest\RedBearLab_BLE_Nanotest.ino:29:0:

C:\Users\sugar\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleRedBearLab_BLE_Nano.h:25:21: fatal error: BLE_API.h: No such file or directory

#include <BLE_API.h>

                 ^

compilation terminated.

exit status 1
Error compiling for board BLE_Nano2.

I have looked at the forum and noticed someone had an identical problem in 2016 and posted in this forum and got no response: https://community.blynk.cc/t/looking-for-redbear-nano-ble-header-file-ble-api-h/9729

Is there somewhere I can find this BLE_API.h as it’s not in my arduino library where all the other blynk files are installed. I am including my code below, this is the BLE nano example available on github and from the arduino user interface under blynk examples, all I’ve done is add my auth code.


/*************************************************************
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  This example shows how to use RedBearLab BLE Nano
  to connect your project to Blynk.

  NOTE: BLE support is in beta!

 *************************************************************/

//#define BLYNK_USE_DIRECT_CONNECT

#define BLYNK_PRINT Serial

#include <BlynkSimpleRedBearLab_BLE_Nano.h>
#include <BLE_API.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "f8e43fc741454f19ae14b7e9808ec808";

uint8_t device_name[] = "Blynk";

void setup() {
  Serial.begin(9600);
  delay(100);

  ble.init();

  ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED);
  ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME,
                                         device_name, sizeof(device_name) - 1);

  ble.gap().setDeviceName(device_name);
  ble.gap().setTxPower(4);

  Serial.println("Waiting for connections...");

  // Add Blynk service...
  Blynk.begin(auth);

  ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
  ble.gap().setAdvertisingInterval(Gap::MSEC_TO_GAP_DURATION_UNITS(1000));
  ble.gap().setAdvertisingTimeout(0);
  ble.startAdvertising();
}

void loop() {
  Blynk.run();
}

Don’t forget redbear.cc support, as found via Googling your error… :stuck_out_tongue_winking_eye:

I found that before posting here, their problem seemed to be that they had the wrong board selected, I have the correct board selected and I still get this error. It may be relevant that I am using the most recent BLE nano (v2) not the 1.5 mentioned in that post. The v2 uses RBL_nRF52832, not the RBL_nRF51822 referenced in the post.

I have checked the RBL_nRF52832 library which looks like it has a different folder structure from the old version. Instead of being in the core folder of RBL_nRF52832, the API file it’s in a sub-folder called “FEATURE_BLE” and is called “nRF5x_BLE_API.h”

Is there a way to get blynk to work with the updated structure for redbear nano v2?

Your error implies a missing library… and it appears it is not a Blynk supplied one, so you need to either find the correct library or determine if you are using an old sketch that is using an old/obsolete library… which based on that other topics date does seem probable.

This sketch is the same one currently on the Blynk Github here: https://github.com/blynkkk/blynk-library/blob/master/examples/Boards_Bluetooth/RedBearLab_BLE_Nano/RedBearLab_BLE_Nano.ino which references BLE_API.h.

Based on where it’s looking for the BLE_API.h file it appears that the Blynk example was set up for Red Bear BLE Nano 1.0 and 1.5 but the current libraries for the 2.0 aren’t formatted in the same way. The BLE Nano 2.0 hardware does not use BLE_API.h at all. I downloaded the old 1.0 and 1.5 board libraries to check it out and they have it included, while BLE Nano 2.0 has a different file structure and names. I’ve tried copying BLE_API.h from the old versions to the 2.0 library but it doesn’t work because it references dozens of files that 2.0 doesn’t use (it seems like they changed a lot of things on the software side when they made the v2).

To me it looks like the currently available Blynk example for BLE Nano is incompatible with the BLE Nano v2 and I should use the 1.0 or 1.5 hardware to utilize Blynk.