PlatformIO Community

Library Frustration

PlatformIO wants to have all the libraries, right? Sounds like it.
Why wouldn’t you have a utility for people to submit libraries for inclusion?
I saw the command prompt text, but it didn’t work. Couldn’t find the file specified, so I guess I don’t have the right application.

These are the errors:
Found 197 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <CurieBLE> 2.0
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLECentral.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLECharacteristic.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLEDescriptor.cpp.o
In file included from c:\users\joema\documents\libraries\curieble\src\internal\bleattribute.h:23:0,
                 from C:\Users\joema\Documents\libraries\CurieBLE\src\BLEDescriptor.cpp:21:
C:\Users\joema\Documents\libraries\CurieBLE\src/BLECommon.h:26:54: fatal error: ../src/services/ble_servi
compilation terminated.
In file included from C:\Users\joema\Documents\libraries\CurieBLE\src\CurieBLE.h:33:0,
                 from C:\Users\joema\Documents\libraries\CurieBLE\src\BLECentral.cpp:20:
C:\Users\joema\Documents\libraries\CurieBLE\src\BLECommon.h:26:54: fatal error: ../src/services/ble_servi
compilation terminated.
In file included from C:\Users\joema\Documents\libraries\CurieBLE\src/CurieBLE.h:33:0,
                 from src\main.cpp:18:
C:\Users\joema\Documents\libraries\CurieBLE\src/BLECommon.h:26:54: fatal error: ../src/services/ble_servi
compilation terminated.
In file included from C:\Users\joema\Documents\libraries\CurieBLE\src\CurieBLE.h:33:0,
                 from C:\Users\joema\Documents\libraries\CurieBLE\src\BLECharacteristic.cpp:22:
C:\Users\joema\Documents\libraries\CurieBLE\src\BLECommon.h:26:54: fatal error: ../src/services/ble_servi
compilation terminated.
*** [.pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLEDescriptor.cpp.o] Error 1
*** [.pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLECentral.cpp.o] Error 1
*** [.pio\build\esp32doit-devkit-v1\libe3f\CurieBLE\BLECharacteristic.cpp.o] Error 1
*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
======================================================================================================= 

This is the library, in the lib folder:
libraries

This is the .ini file, and the library is also in my libraries directory.

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_extra_dirs = ${sysenv.HOMEDRIVE}${sysenv.HOMEPATH}\Documents\libraries

How can I make this chronic problem of adding libraries go away? Does having the library in the /lib folder do anything to the same library in the /libraries folder? I’m failing to do something.

Here’s the code:

/*

   Copyright (c) 2016 Intel Corporation.  All rights reserved.

   See the bottom of this file for the license terms.

*/

/*

 * Sketch: BatteryMonitor.ino

 *

 * Description:

 *     This sketch example partially implements the standard Bluetooth

 *   Low-Energy Battery service and connection interval paramater update.

 *

 *   For more information:

 *     https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx

 *

 */

#include <Arduino.h>

#include <CurieBLE.h>

BLEService batteryService("180F"); // BLE Battery Service

// BLE Battery Level Characteristic"

BLEUnsignedCharCharacteristic batteryLevelChar("2A19",  // standard 16-bit characteristic UUID

    BLERead | BLENotify);     // remote clients will be able to

// get notifications if this characteristic changes

int oldBatteryLevel = 0;  // last battery level reading from analog input

long previousMillis = 0;  // last time the battery level was checked, in ms

void setup() {

  Serial.begin(9600);    // initialize serial communication

  pinMode(13, OUTPUT);   // initialize the LED on pin 13 to indicate when a central is connected

  // begin initialization

  BLE.begin();

  /* Set a local name for the BLE device

     This name will appear in advertising packets

     and can be used by remote devices to identify this BLE device

     The name can be changed but maybe be truncated based on space left in advertisement packet

  */

  BLE.setLocalName("BatteryMonitor");

  BLE.setAdvertisedService(batteryService);  // add the service UUID

  batteryService.addCharacteristic(batteryLevelChar); // add the battery level characteristic

  BLE.addService(batteryService);   // Add the BLE Battery service

  batteryLevelChar.setValue(oldBatteryLevel);   // initial value for this characteristic

  /* Start advertising BLE.  It will start continuously transmitting BLE

     advertising packets and will be visible to remote BLE central devices

     until it receives a new connection */

  // start advertising

  BLE.advertise();

  Serial.println("Bluetooth device active, waiting for connections...");

}

void loop() {

  // listen for BLE peripherals to connect:

  BLEDevice central = BLE.central();

  // if a central is connected to peripheral:

  if (central) {

    Serial.print("Connected to central: ");

    // print the central's MAC address:

    Serial.println(central.address());

    // turn on the LED to indicate the connection:

    digitalWrite(13, HIGH);

    // check the battery level every 200ms

    // as long as the central is still connected:

    while (central.connected()) {

      long currentMillis = millis();

      // if 200ms have passed, check the battery level:

      if (currentMillis - previousMillis >= 200) {

        previousMillis = currentMillis;

        updateBatteryLevel();

      }

    }

    // when the central disconnects, turn off the LED:

    digitalWrite(13, LOW);

    Serial.print("Disconnected from central: ");

    Serial.println(central.address());

  }

}

void updateBatteryLevel() {

  /* Read the current voltage level on the A0 analog input pin.

     This is used here to simulate the charge level of a battery.

  */

  int battery = analogRead(A0);

  int batteryLevel = map(battery, 0, 1023, 0, 100);

  if (batteryLevel != oldBatteryLevel) {      // if the battery level has changed

    Serial.print("Battery Level % is now: "); // print it

    Serial.println(batteryLevel);

    batteryLevelChar.setValue(batteryLevel);  // and update the battery level characteristic

    oldBatteryLevel = batteryLevel;           // save the level for next comparison

  }

}

/*

   Copyright (c) 2016 Intel Corporation.  All rights reserved.

   This library is free software; you can redistribute it and/or

   modify it under the terms of the GNU Lesser General Public

   License as published by the Free Software Foundation; either

   version 2.1 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,

   but WITHOUT ANY WARRANTY; without even the implied warranty of

   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public

   License along with this library; if not, write to the Free Software

   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*/

CurieBLE is a BLE library for Intel Curie Boards (https://github.com/arduino/ArduinoCore-arc32/tree/master/libraries/CurieBLE, https://github.com/arduino/ArduinoCore-arc32). You’re compiling for an ESP32. I don’t think this library should work for an ESP32. Does it compile in the Arduino IDE? With which settings?

… that makes sense. I wonder why it was chosen and written into this elaborate program advertised for ESP32. I mean,. written by Intel.

Thank you. I’ll keep looking for something with a generic library.

Arduino is using CurieBLE in their examples:
https://www.arduino.cc/en/Reference/BLEPeripheralConstructor

The important thing is this: I OWN THIS LIBRARY. Why isn’t PlatformIO facing that fact?