IDE Tabs..

Can/are/do the tabs presented in any sketch loaded in the IDE represent modules as a part of the sketch much the same as the modular approach to writing code is presented in the C and C++ text books and is there a better explanation of there use to be found?. What I've found is unsatisfying, So far. I have a sketch that will be multi function and I'd like to keep each separate both manage my code and to leearn how, I've never used a tabbed editor in an IDE before.

Bob

Docedison:
Can/are/do the tabs presented in any sketch loaded in the IDE represent modules as a part of the sketch much the same as the modular approach to writing code is presented in the C and C++ text books and is there a better explanation of there use to be found?. What I've found is unsatisfying, So far. I have a sketch that will be multi function and I'd like to keep each separate both manage my code and to leearn how, I've never used a tabbed editor in an IDE before.

Bob

I've used the tabbed function in the IDE editor to place C/C++ standalone user functions into. The arduino preprocessor just appends them to your main sketch so you don't need to add a include statement in your main sketch to have them included. There are some rules of what you name the tabbed section file name but I forget what they are, I just don't use a .xxx on the name and it works as I would expect, but maybe naming a tab section myfunctions.cpp works OK?

Lefty

retrolefty:
I've used the tabbed function in the IDE editor to place C/C++ standalone user functions into. The arduino preprocessor just appends them to your main sketch so you don't need to add a include statement in your main sketch to have them included. There are some rules of what you name the tabbed section file name but I forget what they are, I just don't use a .xxx on the name and it works as I would expect, but maybe naming a tab section myfunctions.cpp works OK?

Lefty

Tabs are separately compiled modules passed to the linker.

You can verify by holding down the shift key when you build the project. This outputs the build process in which you can see each tab passed to the compiler and linked against the sketch!

lloyddean:

retrolefty:
I've used the tabbed function in the IDE editor to place C/C++ standalone user functions into. The arduino preprocessor just appends them to your main sketch so you don't need to add a include statement in your main sketch to have them included. There are some rules of what you name the tabbed section file name but I forget what they are, I just don't use a .xxx on the name and it works as I would expect, but maybe naming a tab section myfunctions.cpp works OK?

Lefty

Tabs seem to be separately compiled modules passed to the linker.

Might well be, as I said it works pretty transparently as I have used it.

Lefty

I use them a lot for large programs.
The main named tab I use for notes, then create more with names like these for example for a program that reads switches at fixed time interval and sets a flag if something changed to update the display:
sketch_name
a_presetup
b_setup
c_startloop just has void loop(){ so autoformat can be used in other tabs
d_loop_time_check without compiler complaints about missing { or }
e_switches
f_display_update
g_endloop with final }

Software guys may have fits with this approach; too bad! I'm a hardware designer and it works for me :wink:

Thank You All, I think when the 3 ideas are put together i get a much better idea of how to handle a larger sh\ketch and with any luck this will be a most interesting thread. I think I can safely assume that the tabs are saved along with the sketch, yes?

Bob

Docedison:
Thank You All, I think when the 3 ideas are put together i get a much better idea of how to handle a larger sh\ketch and with any luck this will be a most interesting thread. I think I can safely assume that the tabs are saved along with the sketch, yes?

Bob

Yes, the sketch folder will contain a folder for the main sketch and a folder for each tabbed section you use. When you open the sketch it loads up all the other tab section you used when you saved the sketch.

Lefty

So the true reason for the 'unusual' method of closing a sketch 'imported into the environment finally pops up...
Long have I pondered the mystery 'lurking' there

Sometimes a 'new' sketch can get 'dumped' into some strange places..

Bob

lloyddean:
You can verify by holding down the shift key when you build the project. This outputs the build process in which you can see each tab passed to the compiler and linked against the sketch!

Wish that it were so! I'm using 1.0.2 and don't see that behavior. Neither with shift-click nor shift-ctrl-R. I seem to have to go to preferences and add build.verbose=true (or something like that) every time.

Can you elaborate?

Thanks,
John

My apologies you are correct. I don't use the Arduino IDE and I often forget that as the IDE I use most often still works that way.