Sometimes, you may feel the need to define your own custom header files, for organizing your code better. Say you want to create a global_variables.h file for storing all your global variables.
You can create the file within Arduino IDE by clicking on the bottom arrow at the top right of the screen, and selecting 'New Tab'. (Alternatively, you can press Ctrl+Shift+N on your keyboard)
Name your file in the prompt and press OK.
The new file gets created, and can be found in your Sketch folder.
In order to include this file in your main .ino code, you can simply add the following line at the top of your application −
You can replace global_variables.h with the file name you provided in the prompt.
Now you can go ahead and add all global variables in this new .h file. In general, this feature helps a lot when you try to organize lengthy codes.