You can have multiple .ino
files in an Arduino sketch.
So if you create a "master" sketch, then do Sketch > Add File... and add each of your other sketches they will be copied into the sketch folder and you will see a tab appear for each file in the Arduino IDE editor.
Now, the problem is that you can only have one setup()
and one loop()
function, and can't have conflicting names in a project. So you can't just throw together multiple sketches that run individually. But you could make functions from the code in each of your sketches and then call those functions as needed from your single setup()
and loop()
functions, as shown in the code you posted.
I find the use of tabs in a large Arduino project very useful. I will frequently have one tab for global declarations, one for constant definitions, one for setup()
, one for loop()
, one or more for functions, and one for commented notes on the project. This makes it so I don't have to do so much scrolling to find something.