multiple patches

Hi, I'm preparing a performance using arduino and I made 5 different patches (.pde).
what's the best way to put them together?
if I put all the code in the same window I'll have a huge code and it'll be hard to find the specific parts.
is there a way to separete the parts in different tabs, like when i add a .h file?
how can I make it?

thanks,
1mpar

Yes, in the upper right of the IDE there is a create tabs button, put the guts of each sketch in each one. There can only be one void loop.
How do the different sketches get called?
I have done something like read the serial input in void loop(){ , then use switch:case to jump to the section to be run, at the end it goes to back to loop to wait for the next command.
I also named the tabs like a_tab1, b_tab2, c_tab3 so they show in order across the screen, and I think perhaps they put together that way for compiling also.
I have to look, I think the sketch gets saved with the name of the first tab.
I break my code up like this to make it easier to find stuff on big (10-12K) programs:
a_comments
b_preset
c_setup
d_loop1
e_loop2
f_other_stuff, maybe function, pitches.h, etc.

void loop(){ if (Serial.available() >0){ sketchNumber = Serial.read(); } switch (sketchNumber){ case 0: // do nothing here for this case break;  // ends the switch, goes out to check for serial data again // end of tab 1 // put this at start of tab 2 case 1: // code sketchNumber = 0; // reset so it does not repeat break; // end of tab 1 // start of tab 2 case 2: // code sketchNumber = 0; // reset so it does not repeat break; // end of tab 2 start of tab 3 case 3: // code sketchNumber = 0; // reset so it does not repeat break; } // closes out switch (sketchNumber) } // closes out void loop // end of tab 3 

I may not be understanding your problem correctly, but this sounds like the very problem that languages like C++ were created to solve.

You could take all of the program erm, "segments", and same them in separate header files, then include them in a main class and call them like functions.

You could call the functions based on time, button presses, or anything else.

Sounds like it. I've never done any C programming. I just found a way to make the IDE work for me.

It's just object oriented programming, which is what you described. :slight_smile:

I love the simplified C++ in use in the Arduino IDE, as I have limited experience as a programmer (taking online classes currently).

You can take a bunch of functions like

void tacos(){ } and void burritos(){ }

and break them up into different files and call them on the fly. OOP rules :slight_smile: