Creating own libraries versus keeping code in main project cons and pros...

SvanteJ:
My Questions are, by moving code to an external lib:

  • Will it affect performance?
  • Will it use more memory in ROM (Compile time)?
  • Will it use more memory in RAM?
  • Will it work to have dependencies i many levels?

Write libraries if you intend on encapsulating complete functionality: links GPS, DHT11, GLCD, etc.
Otherwise, write functions and drop them into a separate .H tab in Arduini GUI.

LIBRARIES are linked in so really are functions. Classes have overhead, but also utility. Non-used flash memory is nonproductive but then the specific project may not require 100% of flash! SRAM is precious, so pass pointers to functions andbe kind to the "stack".

But, a microcontroller is not an enterprise server with an 80-90% utilization goal. It is a fixed $3 piece of sand. If your project is worthwhile and uses only 20% of thee uC resources, there is no need to be concerned. Write decent functions and if you find that a set of functions are always required for a particular need, these are candidates for a library.

Ray