My apologies if this is an FAQ. I've got a number of related projects/sketches in a tree of subdirectories which are saved in an on-site VCS (Subversion):
/usr/local/src/arduino-examples$ ls -1a . .. Adafruit_INA219 double-tap double-tap-and-hello ei_eio_serial epd2in13-demo epd7in5b_V2-demo GxEPD2_Example mega-sdcard piconomix .svn
These are basically demo projects from various places which I don't want to modify other than improving comments (e.g. making sure that physical connection information is near the top of the file) for my own use.
I would like to add a single line in the setup() function to output board information using the hack described in Determining the board type being used, revisited - Programming Questions - Arduino Forum but I would prefer to have the function/macros defined local to this group of projects rather than being global to the IDE.
with a view to putting the .h and .cpp file "one level up" from the sketches themselves, but the IDE reported that the .h file couldn't be found. If I use an absolute path
the header file is found but the associated .cpp file isn't compiled/linked. If I move the .h and .cpp files into the same directory as a sketch and put no directory info in the #include directive the sketch builds and runs as expected.
Is there a "correct" way of doing this that doesn't involve installing a library which would be global to the IDE and is more elegant than copying the .h and .cpp to every sketch's folder?