Hi, I am trying to make a library with just example code. I guess that is not how it is intended to work as I can't get the example codes to show up under the examples tab. I have a my_examples folder with don't have any header files or ccp files in it, just an examples folder with folders for each example code within. how can I get it to show up under the example tab?
In order to be a valid library, it must either have a header file in the root of the library folder or else a library.properties
file in the root of the library folder and a header file under the src
subfolder. However, that header file can be empty. So you only need to add the necessary files to make it a valid library and then the examples will show up just as usual.
This technique has been used to good effect in the past as a way to bundle example sketches with boards platforms, for example:
I do recommend that you add a comment to the .h file to make it clear that it was intentionally left empty. Otherwise, it might cause confustion in the future.
If you chose to add the library.properties file, you can find information about its format here:
https://arduino.github.io/arduino-cli/latest/library-specification/#library-metadata
pert:
In order to be a valid library, it must either have a header file in the root of the library folder or else alibrary.properties
file in the root of the library folder and a header file under thesrc
subfolder. However, that header file can be empty. So you only need to add the necessary files to make it a valid library and then the examples will show up just as usual.This technique has been used to good effect in the past as a way to bundle example sketches with boards platforms, for example:
Arduino/libraries/esp8266 at 2.7.4 · esp8266/Arduino · GitHubI do recommend that you add a comment to the .h file to make it clear that it was intentionally left empty. Otherwise, it might cause confustion in the future.
If you chose to add the library.properties file, you can find information about its format here:
Redirecting
Thanks alot!!!, that fixed it, thought it would have to be something like that, but it was much easier than I imagined
You're welcome. I'm glad to hear it's working now. Enjoy!
Per