Using TABs in Arduino IDE


#1

Hi,

How is possible to fragment the code in “TABs” when using the Arduino IDE? I am trying to divide the code into different files but the compiler does not regognize the funcions in the other files!


#2

Hi @leoguima,

I assume you simply want to have TABS in the Arduino IDE.
This is how you should do it

it’s on the right upper edge that you can add TABS.
Is this what you are looking for ?
KR,
Rudy


#3

Hi @rudyv,

I am doing it but when I run the compiler, the code in the others TABs are not visible for the main file. Ex: In a secont tab, i created the function test. When I compile, i got this error:

exit status 1
'test' was not declared in this scope

Thanks for your attention!


#4

I saw you are compiling your code using Arduino IDE 1.6.5. How about upgrading it to 1.6.7 or above? Since the Duo board package is not customed for the version you are using.

Cheers!


#5

@guohui, Hi, i just took a screenshot of An arduino ide 1.6.5 as an example for @leoguima. I’m not using the arduino ide for the duo, i go for the particle ide.

KR
Rudy


#6

@rudyv Oh, yes. My mistake :wink:. @leoguima, this issue occurred in the forward board package version – I don’t remember the exact version number which has this issue. You’d better use the latest board package version and the firmware version to have a try.

Cheers!


#7

Hi @guohui,
I am using the arduino IDE 1.6.7 with the board package 0.2.7. (I tried with the 0.2.6, but did not work).
The TABs should work in the Arduino IDE, am i correct? What is the version that it is working?


#8

Hi @leoguima:

You can "Tab "the file as the way as @rudyv said but could not DragNDrog the file since 1.6.6.You can also add the file into the Documents Arduino Libraries folder.


#9

Hi @jackson and @rudyv

I am using the tabs as @rudyv said. Here is an example:

This way, when I compile the code, the functions in the file “_97_HELP” (just for example, it happends with all TABs) are NOT visible for the other TABs (other files). Here is the error:

The function coordinateToIndex is in the _97_HELP file.

Is it possible to compile the code the way I am using?


#10

Hi @leoguima:

I am using the Arduino IDE 1.6.8 and I pushed the src file to the folder which the ino file located and I opened the IDE again , it added the file to it automatically.


#11

Take a look at https://www.arduino.cc/en/Hacking/LibraryTutorial it should explain to you how to do classes in .h and .cpp files.
Also, if you want a regular variable to be visible on other tabs do this:

int myVariable = 4;
in the first tab for example

then in the other tab(s) you declare:

extern int myVariable; // without the =4 part obviously


#12

Thanks for the sugestion!

It is working now!


#13

Let me place a silly question…

Scenario:
Too many tabs to see all them on the top.

How can I move around them to “see” the hidden ones ??

Thanks,
Rafa.


#14

Try this - http://arduino.land/FAQ/content/7/43/en/breaking-a-sketch-into-multiple-files.html