1

I'd like to find out:

  • how big can an Arduino project get, is there some limit?
  • are there examples of large open source code bases? I did some research but find only example projects with single .ino file. Are there projects with multiple files e.g. functions, constants in separate files say to avoid a 10K+ .ino file?
4
1

Big projects are likely not developed with Arduino IDE. Arduino IDE was make for designers/inventors, not for programmers.

Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a background in electronics and programming.

Source

Programmers will use a fully-fledged IDE which has many features a programmer needs on a daily basis, such as:

  • handling multiple files efficiently
  • allowing to create libraries instead of just setup() and loop()
  • code completion (suggestions as you type)
  • debugging (inspection and changing of variables at runtime)
  • refactoring (modifying the structure of your code without changing the behavior)
  • integrated version control (like Git / Github)

Such an IDE could be Eclipse with an Arduino Plugin or Atmel Studio and perhaps Visual Studio.

So, what do you need to look for? Don't look for .ino files. Instead, look for .h and .cpp code, just like other non-Arduino C++ code.

Some examples:

1

Again im late to the party...

If you are planning on making a larger project and splitting things up you can take advantage of libraries. This will work even if you are married to the arduino ide for some reason. if your not married to the arudino ide platformio doesn't suck too bad, and makes libraries a bit less messy when your doing the grunt work of setting them up the first time.

The idea should be to break your problem into smaller testable pieces of code into smaller testable libraries. If your code doesn't depend on arduino features you may be able to use test your library fully on a bigger machine to make sure there are no bugs (for example abuse clangs static analysis tool to see if you made any dumb pointer errors https://clang-analyzer.llvm.org/)

I kinda set an example of this (https://gitlab.com/mikealger/ExampleArduinoProjectStructure) up for students a while back but i still think its handy for anyone looking to build /manage the lifecycle of a project, I still use the basic ideas when i'm doing one off small projects based on others work to keep my notes straight i.e. https://gitlab.com/mikealger/celstronhomebrewgps

yea its probably shameless promotion but i haven't logged in for like 2 years...

0

Each sketch uses Flash memory, you can see this when you compile your project. You also can see how much percentually you have used.

And as jsotola explains, libraries are examples how multiple files can be used.

However, next to you .ino scene (in the same folder) you can put .h, .c and .cpp files which are automatically compiled (when used by the .ino file). However, if you use too many files, because tabs are placed horizontally in the Arduino IDE, it's better to use a decent editor. And while doing that, you use the Arduino IDE to compile (only).

0

Thats an example how to organize by function groups.
Other good complex examples can be found when searching for
Arduino esp8266 webserver site:github.com
The limit is basically your IDE -If you use ArduinoIDE the limit is (without already tested and working lib files) around 20 files, more is a pain in the a** to handle.

I keep the length of my files between 500 - max 1000 lines. For documentation and keeping relationship diagrams (valuable for debug) I use doxygen with the graph extension.

When using an IDE like eclipse you can use more files, you have a good overview over your classes, but time to spend (and learn) configuring a project is initially much higher and there are sometimes (release dependent) breaking changes in the tool chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.