I have a custom board package that I can install from URL but I haven't figured out where to put my examples specific to that board so that they show up under File>Examples
Hi @eng101. Is this a package you're developing yourself?
There is no sketch-specific mechanism for providing examples with boards packages. However, there is a mechanism for providing libraries with boards packages, and those libraries can have example sketches. The technique the Arduino boards package developer community has adopted for bundling examples with a boards package is to create a dummy platform bundled library, which serves solely as a container for examples. You can see a couple prominent example of that here:
- Arduino/libraries/esp8266 at master · esp8266/Arduino · GitHub
- MightyCore/avr/libraries/AVR_examples at master · MCUdude/MightyCore · GitHub
These are valid libraries, and must be so in order to be recognized by the Arduino development software, but their .h files are empty other than an explanatory comment to prevent any confusion.
Even though there have been a couple requests to add support for platform examples, I think this approach works very well and shows that the existing system is sufficient for this use case.
Yes a package I am developing. This is perfect, this was the approach I had taken but a) I thought it was a bit hacky and there must a be a better way and b) I had not included all of the library files (just the examples folder) so it didn't actually work.
These examples were exactly what I was trying to find, I added the dummy header and I was able to get it to work.
I'm glad to hear it's working now. Enjoy!