# Tabs in the editor - how can I use them?

**URL:** <https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522>\
**Category:** IDE 1.x\
**Created:** [March 17, 2022, 10:54pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522 "2022-03-17T22:54:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![RDeangelis](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@RDeangelis](https://forum.arduino.cc/u/RDeangelis)\
**Post date:** [March 17, 2022, 10:54pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/1 "2022-03-17T22:54:01Z")

</div>

I feel stupid for asking this, but I've been using Arduino and the editor for years and I just noticed on the top right side there is a button to add tabs to the code editing window to create multiple files of code.

Is this a way to work on multiple unique programs at one time, or is this a way to break my long programs into sections that all compile for one download? (I would much, much prefer the later.) It didn't seem to compile when I broke working code into separate tabs, but I haven't explored it fully and could have simply not declared the right things.

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [March 17, 2022, 10:56pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/2 "2022-03-17T22:56:01Z")

</div>

break long into shorts and for your own classes to name a few uses.

---

<div class="post-metadata">

**Author:** ![RDeangelis](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@RDeangelis](https://forum.arduino.cc/u/RDeangelis)\
**Post date:** [March 17, 2022, 10:57pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/3 "2022-03-17T22:57:32Z")

</div>

I don't understand. Long and short variables? Long and short functions? In one compiled piece of software?

---

<div class="post-metadata">

**Author:** ![mrburnette](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mrburnette/32/702556_2.png) [@mrburnette](https://forum.arduino.cc/u/mrburnette)\
**Post date:** [March 17, 2022, 10:58pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/4 "2022-03-17T22:58:34Z")

</div>

> [@RDeangelis](#):
>
> In one compiled piece of software?

> [@I am looking for a sketch](https://forum.arduino.cc/t/i-am-looking-for-a-sketch/968986/6):
>
> Similar idea, but I "tab" them and let ArduinoIDE do the function prototypes and move all the main-tab crud off into a tab or two to cleanup loop() so it is easy to understand the program flow: The above is a single sketch with NO library dependencies outside the sketch folder. The loop is nice and concise: void loop(void) { gfxtest(); for(uint8\_t rotation=0; rotation\<4; rotation++) { tft.setRotation(rotation); testText(); delay(1000); } } Really easy to Zip …

> [@RDeangelis](#):
>
> is this a way to break my long programs into sections that all compile for one download?

Organization primarily.  
I take the concept to extreme.

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [March 17, 2022, 10:58pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/5 "2022-03-17T22:58:40Z")

</div>

So you have one long program and you want to break it up into shorter pieces, tabs work for doing the thing.

Or you have secret info like passwords that you can keep in a separate file/tab so that when you share code the secret stuff is not shared.

Or if you want to edit a library, pull the library code into tabs and edit away.

---

<div class="post-metadata">

**Author:** ![mrburnette](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mrburnette/32/702556_2.png) [@mrburnette](https://forum.arduino.cc/u/mrburnette)\
**Post date:** [March 17, 2022, 11:02pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/6 "2022-03-17T23:02:48Z")

</div>

> [@Idahowalker](#):
>
> secret info like passwords that you can keep in a separate file

... this is seen often in ESP32/ESP8266 sketches and I suspect the Arduino brand of IoT boards, too.

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [March 18, 2022, 12:07am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/7 "2022-03-18T00:07:12Z")

</div>

I like to put structs in a tab by themselves.

Same with State Machine code sections.

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [March 18, 2022, 12:08am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/8 "2022-03-18T00:08:30Z")

</div>

> [@Idahowalker](#):
>
> Or you have secret info like passwords that you can keep in a separate file/tab

Give the tab a name like SecretStuff 🤓.

---

<div class="post-metadata">

**Author:** ![RDeangelis](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@RDeangelis](https://forum.arduino.cc/u/RDeangelis)\
**Post date:** [March 18, 2022, 12:19am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/9 "2022-03-18T00:19:44Z")

</div>

OK, thanks you guys. I'll need to experiment more if I can get all tabs to compile into one.

I made a 2nd tab from a good chunk of software, moved some of the global declares into the 2nd tab, and then tried to compile the code. It didn't work and complained that the moved variables were not declared. I didn't find any Arduino written information that discussed how to use tabs.

I am understanding (correctly or not?) that it should treat all the tabs like one piece of software. I do that with Microchip assembly and create a hundred little included files, but when I have to do an Arduino (Mega), I always have one extremely long list of code that can have thousands of lines and take a minute to scroll from place to place if I can find what I'm looking for at all.

---

<div class="post-metadata">

**Author:** ![LarryD](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/larryd/32/215550_2.png) [@LarryD](https://forum.arduino.cc/u/LarryD)\
**Post date:** [March 18, 2022, 12:22am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/10 "2022-03-18T00:22:13Z")

</div>

You need to **include** these tab names in your .ino file.

---

<div class="post-metadata">

**Author:** ![RDeangelis](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@RDeangelis](https://forum.arduino.cc/u/RDeangelis)\
**Post date:** [March 18, 2022, 12:31am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/11 "2022-03-18T00:31:17Z")

</div>

That makes a lot of sense. I guess I was thinking the IDE was smart enough to do it for me.  
So in the beginning of the first, main file I add something like:

#include functionA.ino, functionB.ino ; ?

...Not sure of the syntax right now but I can look that up.

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [March 18, 2022, 12:38am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/12 "2022-03-18T00:38:19Z")

</div>

```cpp
#include "MyBitmap.h"
#include "certs.h"

```

Name the tabs with a .h at least. Consider the ino to be a workbook. and the .h and .cpp tabs individual portions.

![](https://europe1.discourse-cdn.com/arduino/original/4X/3/5/0/350893fb165e2d6ece91b59c81712c73e1c36837.jpeg)

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/8/a/2/8a2fa258343a10f51af3fa1fc60e0ef00e9aa8cd.jpeg)

---

<div class="post-metadata">

**Author:** ![mrburnette](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mrburnette/32/702556_2.png) [@mrburnette](https://forum.arduino.cc/u/mrburnette)\
**Post date:** [March 18, 2022, 11:59pm UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/13 "2022-03-18T23:59:59Z")

</div>

> [@RDeangelis](#):
>
> I guess I was thinking the IDE was smart enough to do it for me.

It IS IF you do not give the tab any extension as it defaults to .ino and will be handled by the Arduino build system prior to the forward declarations. All of this preprocessing happens before the C++ compiler.

---

<div class="post-metadata">

**Author:** ![in0](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@in0](https://forum.arduino.cc/u/in0)\
**Post date:** [March 20, 2022, 3:10am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/14 "2022-03-20T03:10:47Z")

</div>

> [@mrburnette](#):
>
> I suspect the Arduino brand of IoT boards, too.

[Arduino Web Editor](https://docs.arduino.cc/cloud/web-editor) (and thus [Arduino IoT Cloud](https://docs.arduino.cc/cloud/iot-cloud) as well) have a "Secret tab" feature:

> **[Store your sensitive data safely when sharing a sketch | Arduino Documentation](https://docs.arduino.cc/arduino-cloud/cloud-editor/store-your-sensitive-data-safely-when-sharing)**
>
> Learn how to share sketches without sharing the sensitive data such as Wi-Fi credentials and API keys.

On Arduino Web Editor, this is a web form-based tab named "Secret", but if you download the sketch to use locally with the Arduino IDE, it becomes a file in the sketch named `arduino_secrets.h`

---

<div class="post-metadata">

**Author:** ![mrburnette](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mrburnette/32/702556_2.png) [@mrburnette](https://forum.arduino.cc/u/mrburnette)\
**Post date:** [March 20, 2022, 3:48am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/15 "2022-03-20T03:48:14Z")

</div>

> [@in0](#):
>
> [Arduino Web Editor](https://docs.arduino.cc/cloud/web-editor) (and thus [Arduino IoT Cloud](https://docs.arduino.cc/cloud/iot-cloud) as well) have a "Secret tab" feature:
> 
> [https://docs.arduino.cc/cloud/web-editor/tutorials/store-your-sensitive-data-safely-when-sharing/](https://docs.arduino.cc/cloud/web-editor/tutorials/store-your-sensitive-data-safely-when-sharing/)

I see, interesting. I am a Arduino Web Editor virgin, just not my style. But good to know.

- Ray

---

<div class="post-metadata">

**Author:** ![in0](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@in0](https://forum.arduino.cc/u/in0)\
**Post date:** [March 20, 2022, 3:50am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/16 "2022-03-20T03:50:24Z")

</div>

> [@mrburnette](#):
>
> just not my style

Same here. I guess I'm too old for all this "cloud" stuff. But even though I don't use it myself, I try to keep up on it so that I can effectively help out those who do choose to use it.

---

<div class="post-metadata">

**Author:** ![mrburnette](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mrburnette/32/702556_2.png) [@mrburnette](https://forum.arduino.cc/u/mrburnette)\
**Post date:** [March 20, 2022, 3:55am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/17 "2022-03-20T03:55:27Z")

</div>

> [@in0](#):
>
> But even though I don't use it myself

Well I'm definitely in the 'old' category, but I justified my Surface Pro based on the need to power through the locally installed IDE. It would be most unhealthy if wife found out that the old Samsung tablet would have been adequate (the wife got the Samsung as a hand-me-down and those savings help me justify the Surface Pro.)

---

<div class="post-metadata">

**Author:** ![Idahowalker](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/idahowalker/32/238858_2.png) [@Idahowalker](https://forum.arduino.cc/u/Idahowalker)\
**Post date:** [March 20, 2022, 10:04am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/18 "2022-03-20T10:04:07Z")

</div>

> [@mrburnette](#):
>
> but I justified my Surface Pro based on the need to power through the locally installed IDE. It would be most unhealthy if wife

You to! I'm waiting a few months before complaining the Surface Pro is too slow and I need a more, more, more. Now to figure out the justification.

---

<div class="post-metadata">

**Author:** ![mancera1979](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mancera1979/32/732001_2.png) [@mancera1979](https://forum.arduino.cc/u/mancera1979)\
**Post date:** [March 23, 2022, 2:45am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/19 "2022-03-23T02:45:36Z")

</div>

Tabs are read (joined) by the compiler in alphabetical order. So first.ino comes before second.ino and this one before third.ino. But if you add fourth.ino it will then be second…

---

<div class="post-metadata">

**Author:** ![in0](https://avatars.discourse-cdn.com/v4/letter/i/77aa72/32.png) [@in0](https://forum.arduino.cc/u/in0)\
**Post date:** [March 23, 2022, 6:57am UTC](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522/20 "2022-03-23T06:57:09Z")

</div>

> [@mancera1979](#):
>
> in alphabetical order.

The exception is that the `.ino` file that matches the sketch folder name is first in the concatenation order.

For example:

```plaintext
Foo/
├── Bar.ino
├── Baz.ino
└── Foo.ino

```

The concatenation order is:

1. `Foo.ino`
2. `Bar.ino`
3. `Baz.ino`

[Next page](https://forum.arduino.cc/t/tabs-in-the-editor-how-can-i-use-them/970522.md?page=2)
