Custom Library - reference and files to upload

Hi,

I want to create my own custom library and I am reading this post arduino-creating-library-guide.

I think I understood this but I have two questions when using Arduino IDE

  1. If my custom library has a dependency on another 3rd party library, I can just include that in my header file. But is it expected that users will download that 3rd party library by themselves on their local setup? Otherwise, when they run their program it will just error out.
    I can just include it in my readme that my project has a dependency on this 3rd party library and you need to download it yourself.

  2. If my custom library needs to upload something in the filesystem of the microcontroller, then can I just create a folder named "data" or "upload_to_filesystem" and then let my user in my readme documents that this needs to be uploaded to the File System of your microcontroller?

Hope I made things clear. Let me know if something is not.
Thanks.

YES. User must be instructed to download the dependent library to resolve required dependencies.

Hi @neluser

The Arduino Library Manager has a nice feature where if you define dependencies of your library, the Arduino IDE will ask the user if they want to automatically install those libraries as well.

image

This is possible under the following conditions:

  • You have defined the dependencies in the metadata of your library.
  • The dependencies are also listed in the Arduino Library Manager (most of the popular libraries are, and you are also welcome to submit any library if it is not already in there)
  • Your library is listed in the Arduino Library Manager, and the user is using that system to install the library (rather than installing it manually)

Information about the library.properties library metadata file:

https://arduino.github.io/arduino-cli/latest/library-specification/#library-metadata

Information about adding libraries to the Arduino Library Manager:

https://github.com/arduino/library-registry#adding-a-library-to-library-manager

Please let me know if you have any questions.

Regards, Per

Very few Arduino models have a "file system". Did you mean on an SD card? Did you mean on an ESP8266 or an ESP32?

For large constant data tables, most Arduino sketches just include them as a source file and they become part of the sketch.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.