- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Add new header files in Arduino IDE
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.
- Related Articles
- Download a new library in Arduino IDE
- Installing a new library in Arduino IDE 2.0
- What are the major new features in Arduino IDE 2.0?
- Add a new board in Arduino
- Auto-format code in Arduino IDE
- See inbuilt examples in Arduino IDE
- Change board selection in Arduino IDE
- Standard header files in C
- How to change programmer in Arduino IDE
- C++ Standard Library Header Files
- How to show line numbers in Arduino IDE?
- How to compile code using Arduino IDE
- Arduino IDE 2.0 – Using the Boards Manager
- Header files “stdio.h” and “stdlib.h” in C
- Why does C++ have header files and .cpp files?