Create Custom Arduino Library
R2026bThe custom Arduino® library framework enables you to create libraries that execute code on Arduino hardware from MATLAB®.
The framework takes care of the communication and interaction between MATLAB and an Arduino device, enabling you to focus on developing a particular feature. A custom Arduino library has three components:
You can use arduinoio.customLibrary.createLibraryTemplate to generate the folder
structure, MATLAB class file, and C++ header file for your custom Arduino library. You can then modify the generated template based on your
requirements. For more information, see Create Custom Arduino Library Using Template.
You can also create the folder structure, MATLAB class file, and C++ header file manually using the steps in this table.
| Steps | Action | More Information |
|---|---|---|
| 1 | Create custom Arduino library folder package and add subfolders to contain C++ header file and MATLAB class | Create Custom Arduino Library Package Folder |
| 2 | Create and configure C++ header file and add third part resources (if required) for custom library | Create and Configure C++ Header File |
| 3 | Create and configure MATLAB custom Arduino library class that inherits from matlabshared.addon.LibraryBase. | Create and Configure MATLAB Custom Arduino Library Class |
| Adapt Add-ons to New matlabshared.addon.LibraryBase Class | ||
| 4 | Register custom Arduino library and run MATLAB code | Register Custom Arduino Library |
See Also
Custom Arduino Library Concepts | Physical Terminals and Pin Numbers