I would like to create a program with separated modules, is this this possible using Arduino IDE?
While you can create your own libraries for the Arduino, a simple way to make reusable code is to create a header (.h) file that contains the code you would like to make reusable. Specifically, in the Arduino IDE create a new tab with some name You can alternativly use "Normal Arduino code files (no visible extension), C files (.c extension), C++ files (.cpp), or header files (.h)." And one extra note to help you - the header files do not have access to some of the typical Arduino commands and functionality, such as |
|||
|
Arduino sketches can include Libraries (see https://www.arduino.cc/en/Guide/Libraries). In order to work with the Arduino IDE, such a library is required to adhere to a certain folder structure and naming convention (as described in the above guide). Other than that, it's similar to modularized code in any other language. The canonical language in Arduino libraries is C++. Since a regular Arduino IDE installation already comes preinstalled with a multitude of libraries, you can take a look and go from there. I recommend that you look through the example sketches (from the "Examples" menu option). Whenever you see an #include statement at the top of the sketch, you have a hint where to look next in order to gain a better understanding about the inner works. |
|||
|