Breaking up large project

When I was a Java developer using Eclipse - we could break a project down into parts using sub directories

In the arduino IDE you can use tabs to do more or less the same thing -

I am going kind of cross eyed digging trying how to do this same thing in PlatformIO - Would appreciate a link into the docs or a sample project that implements this

You can organize your code within the src/ and lib/ folders as you like, with sub-directory tree structures. You only have to abide by the common C++ rules so that all include files are found etc. So if you have e.g. a structure like

- src/
 - component_1/ 
   | component1.cpp
   | component1.h
 - common/
   | common.h

If inside component1.h, you would e.g. need to write #include "../common/common.h" to reference the common.h file. You can also use build flags to add the common/ directory to the include search path, using the -I flag. However I’d recommend writing code in a way that doesn’t require explicit build flag configuration. For common, shared code, one can also structure it as a library, as seen in the documentation.

A large sample project would e.g. be Marlin (3D printer FW), just have a look at it’s source directory.

1 Like

So the java concept of CLASS is an .h file with defines and the .c file with the actual code - going to take
a few hours wrapping my head around that and a little(lot) of experimentation …

2 Likes