Arduino IDE little trick for tabs organizing

I have been using tabs in arduino IDE to accommodate my long project codes and just want to share a little trick to organize tabs:

This way of naming the tabs, with numbers, helps organize the order of the tabs the way you like them to be, not the way they alphabetically order. Reorganizing tabs also affects the order of compile, FYI.

For more about coding arduino, visit my blog:

http://liudr.wordpress.com/category/coding/

Thanks for that useful tip. I've used tabs a few times for grouping functions.

Lefty

good tip!

Reorganizing tabs also affects the order of compile, FYI.

But what are the advantages? I mean all files need to be compiled anyway so …

robtillaart: good tip!

Reorganizing tabs also affects the order of compile, FYI.

But what are the advantages? I mean all files need to be compiled anyway so ...

1) Organize the files in the order you want them to be. If you are focusing on say two files and you can name them with low and sequential numbers so they show up together near the main file for easy access, instead of to the right and beyond. You can also organize things that you typically update together and assign already done files high numbers so their tabs are out of the way.

2) Manipulate the order which file is concatenated first to the main file. This affects a few things A) Arduino IDE automatically generates the declaration of all functions and attach them in the beginning of main so all calls to those functions are after declaration. But Arduino IDE can't do reference to function properly so any function with a parameter that is a function pointer will need to be hand-declared before they are called, such as a call-back function of something else with an "action" function. You will need to hand declare all those functions in a file and put it before other files that use these functions. B) For security reasons you don't want others to pick your code apart but rather keep all parts of your code, especially credits and some tricks you somehow don't want other to know how to use beyond your sample code, you can cleverly use Arduino IDE's inability to auto declare a function with a parameter that is a function pointer, exploit it with a hand declaration in one file and with all calls to the function in another file but with a larger number so it is concatenated behind the other file. I don't know if I expressed this clearly.

I do something similar for my bigger programs file name a_comments b_pre_setup c_setup d_void1 e_void2 f_void3 g_pitches.h

where void1,2,3 might are big chunks or perhaps functions In my case I had the main part of time tracking/blink without delay, then a couple sections that only acted when a flag was set or if serial data was received and pitches.h for a tone generated warble sound.

Thanks for the explanation,

However if my projects are this complex/big I keep my main in the IDE and the rest in notepad++ (far more convienent). Or I try to "librarize" some of the code :)

As soon as my projects get bigger I usually switch to sconstruct for building and use Kate as an Editor. Especially I ditch the weird IDE and its wrapping code in favour of real C++. Usually I also switch to ISP for flashing as ISP is faster and allow to let the serial monitor connected.

That way you do take away the potential to deploy these projects to customers and update firmware. If you keep the arduino bootloader on the chip, you can just deliver firmware updates in hex files :slight_smile:

Sconstructs /makefiles deliver of course HEX files. If necessary it is also possible to replicate the IDE behaviour. Using an ISP during development does not deny the possibility to use a bootloader for field deployment. It just reduces turn around times for deployment on the development board.