Just recently i discovered that we can use tabs in the Arduino IDE to organize our sketches.
I would like to understand a little bit better how this works, but can’t find so much “easy to understand” information about it.
On the Arduino.cc page (http://arduino.cc/en/Hacking/BuildProcess) i found:
A sketch can contain multiple files (tabs). To manage them, click on the right-facing arrow just above the scroll bar near the top of the environment. Tabs have one of four extensions: no extension, .c, .cpp, or .h (if you provide any other extension, the period will be converted to an underscore). When your sketch is compiled, all tabs with no extension are concatenated together to form the “main sketch file”. Tabs with .c or .cpp extensions are compiled separately. To use tabs with a .h extension, you need to #include it (using “double quotes” not ).
So, this means that i can for instance write a function on a new tab, let say “void checkButton()”, and then still call it from the loop() function on the main tab by something like “checkButton(button1)”?
What are the different extensions for? No extension, .c, .cpp or .h? Does each have its own functionality?
Is it good practice to use multiple tabs even in small sketches, just maybe to keep things more organized, is it better to keep it in one sketch, or is it personal preference? How do you use?
I remember trying an Arduino Instrument which had a separate tab with the list of notes available (they were in a tab called “pitches.h”). This list had to be imported using
Why is this? Why isn’t this notes list available and needs to be imported, but a function is available and doesn’t need to be imported?
Hmmm, many other questions, but maybe some of the answers to this ones will already help me.
…and maybe there are even other people out there, who had never noticed that we can have Tabs! =)